mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Adds Class Invoker documentation on README
This commit is contained in:
parent
57ffc986a8
commit
e28d5a4efb
1 changed files with 15 additions and 0 deletions
15
README.md
15
README.md
|
@ -385,6 +385,21 @@ If you prefer a more Ruby-like guard syntax, you can use `if` and `unless` as we
|
|||
end
|
||||
```
|
||||
|
||||
You can invoke a Class instead a method since this Class responds to `call`
|
||||
|
||||
```ruby
|
||||
event :sleep do
|
||||
transitions :from => :running, :to => :sleeping, :guards => Dog
|
||||
end
|
||||
```
|
||||
```ruby
|
||||
class Dog
|
||||
def call
|
||||
cleaning_needed? && walked?
|
||||
end
|
||||
...
|
||||
end
|
||||
```
|
||||
|
||||
### Transitions
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue