each_byte

ios.each_byte {|byte| block } â ios
ios.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
doc_ruby_on_rails
2015-04-13 10:57:54
Comments
Leave a Comment

Please login to continue.