Class: Gilmour::Composers::AndAnd
- Defined in:
- lib/gilmour/composers.rb
Instance Attribute Summary
Attributes inherited from Pipeline
Instance Method Summary collapse
-
#execute(data = {}, &blk) ⇒ Object
Execute the andand pipeline.
Methods inherited from Pipeline
Constructor Details
This class inherits a constructor from Gilmour::Composers::Pipeline
Instance Method Details
#execute(data = {}, &blk) ⇒ Object
Execute the andand pipeline. The output of the last successful step is passed to block, along with the remaining continuation See the documentation of the #andand method for more details
129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/gilmour/composers.rb', line 129 def execute(data={}, &blk) blk.call(nil, nil) if pipeline.empty? handler = proc do |queue, data, code| if queue.empty? || code != 200 blk.call(data, code, continuation(queue)) else head = queue.first tail = queue[1..-1] head.execute(&handler.curry[tail]) end end handler.call(pipeline, nil, 200) end |