mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
51 lines
1.3 KiB
Text
51 lines
1.3 KiB
Text
callbacks
|
|
|
|
AASM 3
|
|
|
|
begin
|
|
old_state exit # old? should be deprecated -> use old_state.before_exit instead
|
|
event before
|
|
old_state before_exit
|
|
new_state before_enter
|
|
new_state enter # old? should be deprecated -> use new_state.before_enter instead
|
|
...update state...
|
|
transition guard
|
|
event guard
|
|
transition on_transition
|
|
event success # if persist successful
|
|
old_state after_exit
|
|
new_state after_enter
|
|
event after
|
|
rescue
|
|
event error
|
|
end
|
|
|
|
AASM 4
|
|
|
|
todo
|
|
|
|
done
|
|
- move event.before before everything else
|
|
- move old_state.before_exit before old_state.exit
|
|
- move event.guard before transition.guard
|
|
- fire guards before running state callbacks (test run)
|
|
|
|
begin
|
|
event before
|
|
event guard # test run
|
|
transition guard # test run
|
|
old_state before_exit
|
|
old_state exit
|
|
new_state before_enter
|
|
new_state enter
|
|
event guard
|
|
transition guard
|
|
transition on_transition
|
|
...update state...
|
|
event success # if persist successful
|
|
old_state after_exit
|
|
new_state after_enter
|
|
event after
|
|
rescue
|
|
event error
|
|
end
|