Class: Yada::Input
Instance Method Summary collapse
- #each {|accumulator| ... } ⇒ Object
-
#initialize(source, stop = /\.\s+/) ⇒ Input
constructor
A new instance of Input.
Constructor Details
#initialize(source, stop = /\.\s+/) ⇒ Input
Returns a new instance of Input.
5 6 7 |
# File 'lib/yada/input.rb', line 5 def initialize(source, stop = /\.\s+/) @source, @stop = source, stop end |
Instance Method Details
#each {|accumulator| ... } ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/yada/input.rb', line 9 def each(&block) accumulator = '' @source.each do |line| accumulator = regroup(accumulator, line, &block) end yield accumulator if accumulator != '' nil end |