lib/persistence/base.rb in state-fu-0.12.3 vs lib/persistence/base.rb in state-fu-0.13.0
- old
+ new
@@ -6,42 +6,26 @@
module Persistence
class Base
attr_reader :binding, :field_name, :current_state
- def self.prepare_class( klass )
- unless klass.instance_methods.include?( :method_missing_before_state_fu )
- alias_method :method_missing_before_state_fu, :method_missing
- klass.class_eval do
- def method_missing( method_name, *args, &block )
- state_fu!
- begin
- send( method_name, *args, &block )
- rescue NoMethodError => e
- method_missing_before_state_fu( method_name, *args, &block )
- end
- end
- end
- end
- end
-
# define this method in subclasses to do any preparation
def self.prepare_field( klass, field_name )
- Logger.warn("Abstract method in #{self}.prepare_field called. Override me!")
+ Logging.warn("Abstract method in #{self}.prepare_field called. Override me!")
end
def initialize( binding, field_name )
@binding = binding
@field_name = field_name
@current_state = find_current_state()
if current_state.nil?
- Logger.warn("undefined state for binding #{binding} on #{object} with field_name #{field_name.inspect}")
- Logger.warn("Machine for #{object} has no states: #{machine}") if machine.states.empty?
+ Logging.warn("undefined state for binding #{binding} on #{object} with field_name #{field_name.inspect}")
+ Logging.warn("Machine for #{object} has no states: #{machine}") if machine.states.empty?
else
persist!
- Logger.debug("#{object} resumes #{binding.method_name} at #{current_state.name}")
+ Logging.debug("#{object} resumes #{binding.method_name} at #{current_state.name}")
end
end
def find_current_state
string = read_attribute()