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.



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

def entity_changes
  @entity_changes
end

#uidObject

Returns the value of attribute uid.



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

def uid
  @uid
end

Instance Method Details

#entity_eventsObject



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

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

#saveObject



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

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

#set(attr_name, &block) ⇒ Object



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

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