geekq/workflow — pull request #113 by virtualstaticvoid (2014-08-07 12:54:34+00:00)
Title: Add support for specifying event `if` conditions with a method name symbol

Add the ability to define `if` conditions for `events` using an instance method name symbol, in addition to the already supported `proc` or `lambda` way.

```ruby
state :off
event :turn_on, :transition_to => :on,
:if => :sufficient_battery_level?

event :turn_on, :transition_to => :low_battery,
:if => proc { |device| device.battery_level > 0 }
end

# corresponding instance method
def sufficient_battery_level?
battery_level > 10
end
```

Here, the `:sufficient_battery_level?` method is invoked when evaluating the condition.