pluginaweek/state_machine — pull request #159 by balwantk (2012-02-06 10:43:21+00:00)
Title: Allowing for dynamically handled method_missing methods (in say a superclass) to be used during conditional transitions..

If we want to do something like the example below.. since the eval_helper checks for `object.method(method)` if input is a symbol, I was getting a NameError.. i.e method missing is not called. Ive tried to handle this transparently.. Please check code commit. Does this make sense? (its my first pull request)

```ruby
class SomeClassWithStateMachine
state :state, :initial => :starting do

event :go_to_race, :if => :ready_for_the_race do
transition :starting => :ending
end

event :go_to_space, :if => :ready_for_space do
transition :starting => :ending
end

state :starting
state :ending
end

def method_missing(m_name, *args, &block)
if m_name.to_s.split("ready_for_").first.empty? or m_name.to_s.split("ready_for_the_").first.empty?
strategy_name = m_name.to_s.split("_").last
use_readiness_check_strategy(strategy_name)
else
super
end
end

private

def use_readiness_check_strategy(strategy_name)

# Delegate to a strategy object..
strategy_name.camelize.constantize.new
end
end

```