instance method StringIO#bytes
each_byte {|ch| ... } -> self
bytes {|ch| ... } -> self
each_byte -> Enumerator
bytes -> Enumerator
-
自身から 1 バイトずつ読み込み、整数 ch に変換し、それを引数として与えられたブロックを実行します。
- [EXCEPTION] IOError:
- 自身が読み取り不可なら発生します。
a = StringIO.new("hoge") a.each_byte{|ch| p ch } #=> 104 111 103 101
class StringIO