Class: WorkflowTemplate::Outcome

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/workflow_template/outcome.rb,
lib/workflow_template/outcome/block.rb,
lib/workflow_template/outcome/status.rb,
lib/workflow_template/outcome/handler.rb,
lib/workflow_template/outcome/statuses.rb

Defined Under Namespace

Classes: Block, Handler, Status, Statuses

Instance Method Summary collapse

Constructor Details

#initialize(state) ⇒ Outcome

Returns a new instance of Outcome.



11
12
13
# File 'lib/workflow_template/outcome.rb', line 11

def initialize(state)
  @handler = Handler.new(state)
end

Instance Method Details

#dataObject



39
40
41
# File 'lib/workflow_template/outcome.rb', line 39

def data
  final_state.bare_state
end

#handle(&block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/workflow_template/outcome.rb', line 25

def handle(&block)
  binding = block.binding unless block.source_location.nil?
  handler_block = Outcome::Block.new(handler, binding)

  handler_block.instance_eval(&block)

  self.handler = handler_block.handler
  ensure_default_handled!

  freeze

  handler.retval
end