Class: Startback::Operation::MultiOperation
- Inherits:
-
Object
- Object
- Startback::Operation::MultiOperation
- Defined in:
- lib/startback/operation/multi_operation.rb
Instance Attribute Summary collapse
-
#ops ⇒ Object
readonly
Returns the value of attribute ops.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #bind(world) ⇒ Object
- #call ⇒ Object
-
#initialize(ops = []) ⇒ MultiOperation
constructor
A new instance of MultiOperation.
- #size ⇒ Object
Constructor Details
#initialize(ops = []) ⇒ MultiOperation
Returns a new instance of MultiOperation.
5 6 7 |
# File 'lib/startback/operation/multi_operation.rb', line 5 def initialize(ops = []) @ops = ops end |
Instance Attribute Details
#ops ⇒ Object (readonly)
Returns the value of attribute ops.
8 9 10 |
# File 'lib/startback/operation/multi_operation.rb', line 8 def ops @ops end |
Instance Method Details
#+(other) ⇒ Object
14 15 16 |
# File 'lib/startback/operation/multi_operation.rb', line 14 def +(other) MultiOperation.new(@ops + Array(other)) end |
#bind(world) ⇒ Object
18 19 20 |
# File 'lib/startback/operation/multi_operation.rb', line 18 def bind(world) MultiOperation.new(ops.map{|op| op.bind(world) }) end |
#call ⇒ Object
22 23 24 |
# File 'lib/startback/operation/multi_operation.rb', line 22 def call ops.map{|op| op.call } end |
#size ⇒ Object
10 11 12 |
# File 'lib/startback/operation/multi_operation.rb', line 10 def size ops.size end |