method

each_byte

v1_8_6_287 - Show latest stable - Class: IO
each_byte()
public

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.

   f = File.new("testfile")
   checksum = 0
   f.each_byte {|x| checksum ^= x }   #=> #<File:testfile>
   checksum                           #=> 12