Class: EM::Sequence::Block
- Inherits:
-
Object
- Object
- EM::Sequence::Block
- Defined in:
- lib/em-sequence/block.rb
Overview
Block caller sequence item.
Instance Attribute Summary collapse
-
#args ⇒ Array
Input variables specification.
-
#body ⇒ Proc
Holds body of the block.
Instance Method Summary collapse
-
#call(vars, &block) ⇒ Object
Calls the block.
-
#initialize(body, args) ⇒ Block
constructor
Constructor.
Constructor Details
#initialize(body, args) ⇒ Block
Constructor.
46 47 48 49 |
# File 'lib/em-sequence/block.rb', line 46 def initialize(body, args) @body = body @args = args end |
Instance Attribute Details
#args ⇒ Array
Input variables specification.
36 37 38 |
# File 'lib/em-sequence/block.rb', line 36 def args @args end |
#body ⇒ Proc
Holds body of the block.
28 29 30 |
# File 'lib/em-sequence/block.rb', line 28 def body @body end |
Instance Method Details
#call(vars, &block) ⇒ Object
Calls the block.
58 59 60 61 62 |
# File 'lib/em-sequence/block.rb', line 58 def call(vars, &block) call_args = vars.values_at(*@args) result = @body.call(*call_args) block.call(result, result) end |