Class: Startback::Operation::MultiOperation

Inherits:
Startback::Operation show all
Defined in:
lib/startback/operation/multi_operation.rb

Instance Attribute Summary collapse

Attributes inherited from Startback::Operation

#input, #world

Instance Method Summary collapse

Methods inherited from Startback::Operation

emits, #method_missing, #respond_to?, #with_context

Methods included from Support::TransactionPolicy

#after_commit, #transaction_policy, #transaction_policy=

Methods included from Support::OperationRunner

included, #run

Methods included from Errors

bad_request_error!, conflict_error!, expectation_failed_error!, forbidden_error!, gone_error!, internal_server_error!, locked_error!, method_not_allowed_error!, not_acceptable_error!, not_found_error!, not_implemented_error!, precondition_failed_error!, precondition_required_error!, server_error!, unauthorized_error!, unsupported_media_type_error!, user_error!

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Startback::Operation

Instance Attribute Details

#opsObject (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

#callObject



22
23
24
# File 'lib/startback/operation/multi_operation.rb', line 22

def call
  ops.map{|op| op.call }
end

#sizeObject



10
11
12
# File 'lib/startback/operation/multi_operation.rb', line 10

def size
  ops.size
end