Module: Observables::Base::ClassMethods

Defined in:
lib/observables/base.rb

Instance Method Summary collapse

Instance Method Details

#override_mutators(change_groups) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/observables/base.rb', line 91

def override_mutators(change_groups)
  change_groups.each_pair do |change_type,methods|
    methods.each do |method|
      class_eval <<-EOS
        def #{method}(*args,&block)
          changes = changes_for(:#{change_type},:#{method},*args,&block)
                                changing(:#{change_type},:trigger=>:#{method}, :changes=>changes){super}
                                       end
                                EOS
                              end
  end
end