Class: EM::Sequence::Method
- Inherits:
-
Object
- Object
- EM::Sequence::Method
- Defined in:
- lib/em-sequence/method.rb
Overview
Method caller sequence item.
Instance Attribute Summary collapse
-
#args ⇒ Array
Input variables specification.
-
#metablock ⇒ Proc
Block which returns returned variables specification.
-
#name ⇒ Symbol
Holds method name.
-
#target ⇒ Object
Holds method target object.
Instance Method Summary collapse
-
#call(vars, &block) ⇒ Object
Calls the method.
-
#initialize(target, name, args, metablock) ⇒ Method
constructor
Constructor.
Constructor Details
#initialize(target, name, args, metablock) ⇒ Method
Constructor.
64 65 66 67 68 69 |
# File 'lib/em-sequence/method.rb', line 64 def initialize(target, name, args, ) @target = target @name = name @args = args = end |
Instance Attribute Details
#args ⇒ Array
Input variables specification.
44 45 46 |
# File 'lib/em-sequence/method.rb', line 44 def args @args end |
#metablock ⇒ Proc
Block which returns returned variables specification.
52 53 54 |
# File 'lib/em-sequence/method.rb', line 52 def end |
#name ⇒ Symbol
Holds method name.
36 37 38 |
# File 'lib/em-sequence/method.rb', line 36 def name @name end |
#target ⇒ Object
Holds method target object.
28 29 30 |
# File 'lib/em-sequence/method.rb', line 28 def target @target end |
Instance Method Details
#call(vars, &block) ⇒ Object
Calls the method.
78 79 80 81 82 83 84 |
# File 'lib/em-sequence/method.rb', line 78 def call(vars, &block) call_args = vars.values_at(*@args) @target.send(@name, *call_args) do |*returns| result = __combine(self., returns) block.call(result, returns.first) end end |