88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/workflow.rb', line 88
def workflow(&specification)
@workflow_spec = Specification.new(Hash.new, &specification)
@workflow_spec.states.values.each do |state|
state_name = state.name
module_eval do
define_method "#{state_name}?" do
state_name == current_state.name
end
end
state.events.values.each do |event|
event_name = event.name
module_eval do
define_method "#{event_name}!".to_sym do |*args|
process_event!(event_name, *args)
end
end
end
end
end
|