Class: EventSource::Event
- Inherits:
-
Object
- Object
- EventSource::Event
- Defined in:
- lib/event_source/event.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#entity_id ⇒ Object
readonly
Returns the value of attribute entity_id.
-
#entity_type ⇒ Object
readonly
Returns the value of attribute entity_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/event_source/event.rb', line 6 def created_at @created_at end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/event_source/event.rb', line 6 def data @data end |
#entity_id ⇒ Object (readonly)
Returns the value of attribute entity_id.
6 7 8 |
# File 'lib/event_source/event.rb', line 6 def entity_id @entity_id end |
#entity_type ⇒ Object (readonly)
Returns the value of attribute entity_type.
6 7 8 |
# File 'lib/event_source/event.rb', line 6 def entity_type @entity_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/event_source/event.rb', line 6 def name @name end |
Class Method Details
.build_from_data(data) ⇒ Object
9 10 11 12 13 |
# File 'lib/event_source/event.rb', line 9 def build_from_data(data) event = self.new event.send(:new_from_data, data) event end |
.create(name, entity, args) ⇒ Object
15 16 17 18 19 |
# File 'lib/event_source/event.rb', line 15 def create(name, entity, args) event = self.new event.send(:new_from_entity, name, entity, args) event end |
Instance Method Details
#get_args ⇒ Object
22 23 24 |
# File 'lib/event_source/event.rb', line 22 def get_args JSON.parse(data) end |
#save ⇒ Object
26 27 28 29 |
# File 'lib/event_source/event.rb', line 26 def save raise CannotSaveRebuiltEvent if @is_rebuilt EventSource::EventRepository.current.save(self) end |