Method: StringIO#each
- Defined in:
- lib/motion-csv/stringio.rb
#each(sep = $/, limit = nil) ⇒ Object Also known as: each_line, lines
strio.each(sep=$/) {|line| block } -> strio
strio.each(limit) {|line| block } -> strio
strio.each(sep, limit) {|line| block } -> strio
strio.each_line(sep=$/) {|line| block } -> strio
strio.each_line(limit) {|line| block } -> strio
strio.each_line(sep,limit) {|line| block } -> strio
See IO#each.
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/motion-csv/stringio.rb', line 458 def each(sep=$/, limit=nil) if block_given? raise(IOError, "not opened for reading") unless @readable sep, limit = getline_args(sep, limit) if limit == 0 raise ArgumentError, "invalid limit: 0 for each and family" end while line = getline(sep, limit) yield(line) end self else to_enum(:each, sep, limit) end end |