each

ios.each(sep=$/) {|line| block } â iosios.each(limit) {|line| block } â iosios.each(sep,limit) {|line| block } â iosios.each(...) â an_enumeratorios.each_line(sep=$/) {|line| block } â iosios.each_line(limit) {|line| block } â iosios.each_line(sep,limit) {|line| block } â iosios.each_line(...) â an_enumerator Instance Public methods Executes the block for every line in ios, where lines are separated by se

each_byte

ios.each_byte {|byte| block } â iosios.each_byte â an_enumerator Instance Public methods Calls the given block once for each byte (0..255) in ios, passing the byte as an argument. The stream must be opened for reading or an IOError will be raised. If no block is given, an enumerator is returned instead. f = File.new("testfile") checksum = 0 f.each_byte {|x| checksum ^= x } #=> #<File:testfile> checksum #=> 12

each_char

ios.each_char {|c| block } â iosios.each_char â an_enumerator Instance Public methods Calls the given block once for each character in ios, passing the character as an argument. The stream must be opened for reading or an IOError will be raised. If no block is given, an enumerator is returned instead. f = File.new("testfile") f.each_char {|c| print c, ' ' } #=> #<File:testfile>

each_codepoint

ios.each_codepoint {|c| block } â iosios.codepoints {|c| block } â iosios.each_codepoint â an_enumeratorios.codepoints â an_enumerator Instance Public methods Passes the Integer ordinal of each character in ios, passing the codepoint as an argument. The stream must be opened for reading or an IOError will be raised. If no block is given, an enumerator is returned instead.

each_line

ios.each_line(sep=$/) {|line| block } â iosios.each_line(limit) {|line| block } â iosios.each_line(sep,limit) {|line| block } â iosios.each_line(...) â an_enumerator Instance Public methods Executes the block for every line in ios, where lines are separated by sep. ios must be opened for reading or an IOError will be raised. If no block is given, an enumerator is returned instead. f = File.new("testfile") f.each {|line| puts "#{f.lineno}: #{line}" } pr

echo=

io.echo = flag Instance Public methods Enables/disables echo back. On some platforms, all combinations of this flags and raw/cooked mode may not be valid. You must require 'io/console' to use this method.

echo?

io.echo? â true or false Instance Public methods Returns true if echo back is enabled. You must require 'io/console' to use this method.

eof

ios.eof â true or falseios.eof? â true or false Instance Public methods Returns true if ios is at end of file that means there are no more data to read. The stream must be opened for reading or an IOError will be raised. f = File.new("testfile") dummy = f.readlines f.eof #=> true If ios is a stream such as pipe or socket, IO#eof? blocks until the other end sends some data or closes it. r, w = IO.pipe Thread.new { sleep 1; w.close } r.eof? #=> true after 1 second bl

eof?

ios.eof? â true or false Instance Public methods Returns true if ios is at end of file that means there are no more data to read. The stream must be opened for reading or an IOError will be raised. f = File.new("testfile") dummy = f.readlines f.eof #=> true If ios is a stream such as pipe or socket, IO#eof? blocks until the other end sends some data or closes it. r, w = IO.pipe Thread.new { sleep 1; w.close } r.eof? #=> true after 1 second blocking r, w = IO.pipe Thre

expect

IO#expect(pattern,timeout=9999999) â ArrayIO#expect(pattern,timeout=9999999) { |result| ... } â nil Instance Public methods Reads from the IO until the given pattern matches or the timeout is over. It returns an array with the read buffer, followed by the matches. If a block is given, the result is yielded to the block and returns nil. When called without a block, it waits until the input that matches the given pattern is obtained from the IO or the time specifi