Class: StateFu::Executioner

Inherits:
Object show all
Defined in:
lib/executioner.rb

Overview

class that handles executing stuff in the context of your ‘object’

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transition, &block) ⇒ Executioner

Returns a new instance of Executioner.



10
11
12
13
14
# File 'lib/executioner.rb', line 10

def initialize transition, &block
  @transition = transition
  @object     = transition.object
  self
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



8
9
10
# File 'lib/executioner.rb', line 8

def object
  @object
end

#transitionObject (readonly)

Returns the value of attribute transition.



8
9
10
# File 'lib/executioner.rb', line 8

def transition
  @transition
end

Instance Method Details

#evaluate(method_name_or_proc) ⇒ Object



16
17
18
19
# File 'lib/executioner.rb', line 16

def evaluate method_name_or_proc
  args = [transition, transition.arguments]
  evaluate_with_arguments(method_name_or_proc, *args)
end