fixed README: currently after and before callbacks do not support arguments (will come with new major version 4, since this change includes a DSL change)
This commit is contained in:
parent
ca88fefd01
commit
8b9ad865a4
|
@ -94,7 +94,7 @@ class Job
|
|||
state :sleeping, :initial => true, :before_enter => :do_something
|
||||
state :running
|
||||
|
||||
event :run, :after => Proc.new { |user| notify_somebody(user) } do
|
||||
event :run, :after => Proc.new { do_afterwards } do
|
||||
transitions :from => :sleeping, :to => :running, :on_transition => Proc.new {|obj, *args| obj.set_process(*args) }
|
||||
end
|
||||
|
||||
|
@ -117,7 +117,7 @@ class Job
|
|||
...
|
||||
end
|
||||
|
||||
def notify_somebody(user)
|
||||
def do_afterwards
|
||||
...
|
||||
end
|
||||
|
||||
|
@ -125,7 +125,7 @@ end
|
|||
```
|
||||
|
||||
In this case `do_something` is called before actually entering the state `sleeping`,
|
||||
while `notify_somebody` is called after the transition `run` (from `sleeping` to `running`)
|
||||
while `do_afterwards` is called after the transition `run` (from `sleeping` to `running`)
|
||||
is finished.
|
||||
|
||||
Here you can see a list of all possible callbacks, together with their order of calling:
|
||||
|
|
Loading…
Reference in New Issue