Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

StringIO#each

(?::String sep, ?::Integer limit, ?chomp: ::boolish) { (::String) -> untyped } -> self
(?::String sep, ?::Integer limit, ?chomp: ::boolish) -> ::Enumerator[::String, self]
each_line(sep = $/, chomp: false) {|line| ... } -> self each_line(limit, chomp: false) {|line| ... } -> self each_line(sep, limit, chomp: false) {|line| ... } -> self

Calls the block with each remaining line read from the stream; does nothing if already at end-of-file; returns self. See Line IO.

See also #close_write #each_byte #close_read #each_char also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0