Class: Teckel::Chain::Result

Inherits:
Operation::Result show all
Extended by:
Forwardable
Defined in:
lib/teckel/chain/result.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, success, step) ⇒ Result

Returns a new instance of Result.

Parameters:

  • value (Object)

    The result value

  • success (Boolean)

    whether this is a successful result

  • step (Teckel::Chain::Step)


13
14
15
16
# File 'lib/teckel/chain/result.rb', line 13

def initialize(value, success, step)
  super(value, success)
  @step = step
end

Instance Method Details

#deconstructObject



27
28
29
# File 'lib/teckel/chain/result.rb', line 27

def deconstruct
  [successful?, @step.name, value]
end

#deconstruct_keys(keys) ⇒ Object



31
32
33
34
35
# File 'lib/teckel/chain/result.rb', line 31

def deconstruct_keys(keys)
  e = super
  e[:step] = @step.name if keys.include?(:step)
  e
end

#stepString, Symbol

Delegates to step.name

Returns:

  • (String, Symbol)

    The step name of the failed operation.



25
# File 'lib/teckel/chain/result.rb', line 25

def_delegator :@step, :name, :step