Class: Yada::Input

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/yada/input.rb

Instance Method Summary collapse

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

Yields:

  • (accumulator)


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