In Ruby 1.9, bytes, lines, and chars are aliases
s = "A\nB" # Three ASCII characters on two lines
puts s.bytes.to_a # => [65,10,66]: alias for each_byte
puts s.lines.to_a # => ["A\n","B"]: alias for each_line
puts s.chars.to_a # => ["A", "\n", "B"] alias for each_char
Related examples in the same category