Module: Warren::Helpers::StateMachine
Overview
Instance Method Summary collapse
Instance Method Details
#state(state_name) ⇒ Void
35 36 37 38 |
# File 'lib/warren/helpers/state_machine.rb', line 35 def state(state_name) define_method(:"#{state_name}!") { @state = state_name } define_method(:"#{state_name}?") { @state == state_name } end |
#push2(state_name, ...) ⇒ Void
50 51 52 |
# File 'lib/warren/helpers/state_machine.rb', line 50 def states(*state_names) state_names.each { |state_name| state(state_name) } end |