Class: Blooper::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/blooper/input.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flow = STDIN) ⇒ Input

Returns a new instance of Input.



6
7
8
# File 'lib/blooper/input.rb', line 6

def initialize(flow = STDIN)
  @flow = flow
end

Instance Attribute Details

#flowObject (readonly)

Returns the value of attribute flow.



4
5
6
# File 'lib/blooper/input.rb', line 4

def flow
  @flow
end

Class Method Details

.each(*args) ⇒ Object



10
11
12
13
14
15
# File 'lib/blooper/input.rb', line 10

def self.each(*args)
  Input.new(*args).flow.each do |line|
    line = Line.new(line)
    yield Tuple.new(line.clean) if line.valid?  rescue ArgumentError
  end
end