Class: Mementus::Processor
- Inherits:
-
Object
- Object
- Mementus::Processor
- Defined in:
- lib/mementus/pipeline.rb
Instance Method Summary collapse
- #all ⇒ Object
- #append_next(pipe) ⇒ Object
- #id ⇒ Object
-
#initialize(graph, start_pipe) ⇒ Processor
constructor
A new instance of Processor.
- #one ⇒ Object
- #out ⇒ Object
- #process ⇒ Object
Constructor Details
#initialize(graph, start_pipe) ⇒ Processor
Returns a new instance of Processor.
3 4 5 6 |
# File 'lib/mementus/pipeline.rb', line 3 def initialize(graph, start_pipe) @graph = graph @pipeline = [start_pipe] end |
Instance Method Details
#all ⇒ Object
34 35 36 |
# File 'lib/mementus/pipeline.rb', line 34 def all process.to_a end |
#append_next(pipe) ⇒ Object
8 9 10 |
# File 'lib/mementus/pipeline.rb', line 8 def append_next(pipe) @pipeline << pipe end |
#id ⇒ Object
20 21 22 |
# File 'lib/mementus/pipeline.rb', line 20 def id process.id end |
#one ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/mementus/pipeline.rb', line 24 def one output = process if output.respond_to?(:each) output.first else output end end |
#out ⇒ Object
38 39 40 41 |
# File 'lib/mementus/pipeline.rb', line 38 def out append_next(Pipes::Out.new) self end |
#process ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/mementus/pipeline.rb', line 12 def process output = nil @pipeline.each do |pipe| output = pipe.process(@graph, output) end output end |