lib/transitions/state.rb in transitions-0.2.0 vs lib/transitions/state.rb in transitions-0.2.1
- old
+ new
@@ -41,13 +41,14 @@
@options = options
self
end
private
+
def define_state_query_method(machine)
method_name, state_name = "#{@name}?", @name # Instance vars are out of scope when calling define_method below, so we use local variables.
if machine.klass.method_defined?(method_name.to_sym)
- raise InvalidMethodOverride, "Transitions: Can not define method `#{method_name}` because it is already defined - either rename the existing method or the state."
+ fail InvalidMethodOverride, "Transitions: Can not define method `#{method_name}` because it is already defined - either rename the existing method or the state."
end
machine.klass.send :define_method, method_name do
current_state.to_s == state_name.to_s
end
end