method

chars

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

Returns an enumerator that gives each character in ios. The stream must be opened for reading or an IOError will be raised.

f = File.new("testfile")
f.chars.to_a  #=> ["h", "e", "l", "l", "o"]
f.rewind
f.chars.sort  #=> ["e", "h", "l", "l", "o"]