Module: Postman::StateMachine::Helper

Included in:
Postman
Defined in:
lib/postman/state_machine.rb

Instance Method Summary collapse

Instance Method Details

#state(state_name) ⇒ Object


4
5
6
7
# File 'lib/postman/state_machine.rb', line 4

def state(state_name)
  define_method(:"#{state_name}!") { @state = state_name }
  define_method(:"#{state_name}?") { @state == state_name }
end

#states(*state_names) ⇒ Object


9
10
11
# File 'lib/postman/state_machine.rb', line 9

def states(*state_names)
  state_names.each { |state_name| state(state_name) }
end