Skip to content

Commit

Permalink
Merge d62045c into 70176a7
Browse files Browse the repository at this point in the history
  • Loading branch information
billhorsman committed Jun 12, 2013
2 parents 70176a7 + d62045c commit ea39b18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,16 @@ Given the `Job` class from above:
```ruby
job = Job.new

job.states
job.aasm.states
=> [:sleeping, :running, :cleaning]

job.states(:permissible => true)
job.aasm.states(:permissible => true)
=> [:running]
job.run
job.states(:permissible => true)
job.aasm.states(:permissible => true)
=> [:cleaning, :sleeping]

job.events
job.aasm.events
=> [:run, :clean, :sleep]
```

Expand Down
6 changes: 3 additions & 3 deletions lib/aasm/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ def update(options = {}, &block)
self
end

# Execute if test? == false, otherwise return true/false depending on whether it would fire
# Execute if test == false, otherwise return true/false depending on whether it would fire
def _fire(obj, test, to_state=nil, *args)
result = test ? false : nil
if @transitions.map(&:from).any?
transitions = @transitions.select { |t| t.from == obj.aasm_current_state }
return nil if transitions.size == 0
return result if transitions.size == 0
else
transitions = @transitions
end

result = test ? false : nil
transitions.each do |transition|
next if to_state and !Array(transition.to).include?(to_state)
if transition.perform(obj, *args)
Expand Down

0 comments on commit ea39b18

Please sign in to comment.