Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

IO#each_codepoint

ios.each_codepoint {|c| block } → ios
ios.each_codepoint → an_enumerator

Passes the Integer ordinal of each character in ios, passing the codepoint 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.

See also #each_char #each_line #each_byte #echo= also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0