method

each_char

v1_9_1_378 - Show latest stable - Class: IO
each_char()
public

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.

f = File.new("testfile")
f.each_char {|c| print c, ' ' }   #=> #<File:testfile>