Module: EventSource::Entity

Defined in:
lib/event_source/entity.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entity_changesObject (readonly)

Returns the value of attribute entity_changes.



42
43
44
# File 'lib/event_source/entity.rb', line 42

def entity_changes
  @entity_changes
end

#uidObject

Returns the value of attribute uid.



42
43
44
# File 'lib/event_source/entity.rb', line 42

def uid
  @uid
end

Instance Method Details

#entity_eventsObject



51
52
53
54
# File 'lib/event_source/entity.rb', line 51

def entity_events
    @events ||= Array.new
    @events
end

#saveObject



56
57
58
# File 'lib/event_source/entity.rb', line 56

def save
    entity_events.each {|e| e.save}
end

#set(attr_name, &block) ⇒ Object



45
46
47
48
49
# File 'lib/event_source/entity.rb', line 45

def set(attr_name, &block)
    val = block.call
    @entity_changes[attr_name.to_sym] = val
    self.send("#{attr_name}=", val)
end