Class: NxtStateMachine::Transition::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/nxt_state_machine/transition/proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(event, state_machine, transition, context) ⇒ Proxy

Returns a new instance of Proxy.



3
4
5
6
7
8
# File 'lib/nxt_state_machine/transition/proxy.rb', line 3

def initialize(event, state_machine, transition, context)
  @event = event
  @transition = transition
  @state_machine = state_machine
  @context = context
end

Instance Method Details

#call(&block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nxt_state_machine/transition/proxy.rb', line 10

def call(&block)
  proxy = if block.arity == 1
    Proc.new do
      block.call(transition.block)
    end
  else
    block
  end

  around_callback_chain(proxy).call
end