def transition(name, states = self::STATES, transitions = self::TRANSITIONS)
      self.state_machines ||= {}
      self.state_machines[name] = { states: states.values, transitions: transitions }
      self.state_machines[name][:states].each do |this_state|
        method_name = "#{this_state}?".to_sym
        raise 'Method already defined' if self.instance_methods(false).include?(method_name)
        define_method method_name do
          current_state_based_on(this_state) == this_state
        end
      end
    end
def transition(name, states = self::STATES, transitions = self::TRANSITIONS)
      self.state_machines ||= {}
      self.state_machines[name] = { states: states.values, transitions: transitions }
      self.state_machines[name][:states].each do |this_state|
        method_name = "#{this_state}?".to_sym
        raise 'Method already defined' if self.instance_methods(false).include?(method_name)
        define_method method_name do
          current_state_based_on(this_state) == this_state
        end
      end
    end
This assumes states is a hash