Class: Igniter::Extensions::Contracts::Saga::Compensation
- Inherits:
-
Object
- Object
- Igniter::Extensions::Contracts::Saga::Compensation
- Defined in:
- lib/igniter/extensions/contracts/saga/compensation.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#node_name ⇒ Object
readonly
Returns the value of attribute node_name.
Instance Method Summary collapse
-
#initialize(node_name, &block) ⇒ Compensation
constructor
A new instance of Compensation.
- #run(inputs:, value:) ⇒ Object
Constructor Details
#initialize(node_name, &block) ⇒ Compensation
Returns a new instance of Compensation.
10 11 12 13 14 15 16 |
# File 'lib/igniter/extensions/contracts/saga/compensation.rb', line 10 def initialize(node_name, &block) raise ArgumentError, "compensate :#{node_name} requires a block" unless block @node_name = node_name.to_sym @block = block freeze end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
8 9 10 |
# File 'lib/igniter/extensions/contracts/saga/compensation.rb', line 8 def block @block end |
#node_name ⇒ Object (readonly)
Returns the value of attribute node_name.
8 9 10 |
# File 'lib/igniter/extensions/contracts/saga/compensation.rb', line 8 def node_name @node_name end |
Instance Method Details
#run(inputs:, value:) ⇒ Object
18 19 20 |
# File 'lib/igniter/extensions/contracts/saga/compensation.rb', line 18 def run(inputs:, value:) block.call(inputs: inputs, value: value) end |