Module: Rea::MetaType::Commitment

Defined in:
lib/rea/meta_type/commitment.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/rea/meta_type/commitment.rb', line 4

def self.included base
  base.fields = [:amount]
  Entity.included base
  base.extend ::Rea::MetaType::Event::ClassMethods
  base.extend ClassMethods
  base.cattr_accessor :event_handler
  base.after_save :after_save_commitment
end

Instance Method Details

#after_save_commitmentObject



13
14
15
16
17
# File 'lib/rea/meta_type/commitment.rb', line 13

def after_save_commitment
  if self.respond_to?(:fulfilled_changed?) && fulfilled_changed?
    self.instance_exec &self.class.event_handler if self.class.event_handler
  end
end