1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

correct wrong events in the inspection section of the README

This commit is contained in:
Thorsten Böttger 2014-10-10 23:41:59 +02:00
parent 465bb0c0e4
commit 0b5cedf478

View file

@ -504,22 +504,25 @@ end
AASM supports a couple of methods to find out which states or events are provided or permissible.
Given the `Job` class from above:
Given this `Job` class:
```ruby
job = Job.new
job.aasm.states.map(&:name)
# show all states
Job.aasm.states.map(&:name)
=> [:sleeping, :running, :cleaning]
job = Job.new
# show all permissible (reachable / possible) states
job.aasm.states(:permissible => true).map(&:name)
=> [:running]
job.run
job.aasm.states(:permissible => true).map(&:name)
=> [:cleaning, :sleeping]
# show all possible (triggerable) events (allowed by transitions)
job.aasm.events
=> [:run, :clean, :sleep]
=> [:sleep]
```