Class: Ector::Multi::Operation::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ector-multi/operations.rb

Direct Known Subclasses

Create, Destroy, DestroyAll, Error, Lambda, Update, UpdateAll

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, block) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/ector-multi/operations.rb', line 9

def initialize(name, block)
  @name = name
  @block = block
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/ector-multi/operations.rb', line 7

def name
  @name
end

Instance Method Details

#fail_fast?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/ector-multi/operations.rb', line 26

def fail_fast?
  self.is_a?(Ector::Multi::Operation::Error)
end

#inspectObject



14
15
16
# File 'lib/ector-multi/operations.rb', line 14

def inspect
  "#<#{self.class.name} #{@name}>"
end

#run(results) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/ector-multi/operations.rb', line 18

def run(results)
  output = @block.(results)

  perform(output)
rescue Ector::Multi::Rollback => error
  raise Ector::Multi::OperationFailure.new(self, output, error)
end