Module: Journaled::Event
Instance Method Summary collapse
- #created_at ⇒ Object
- #event_type ⇒ Object
-
#id ⇒ Object
Base attributes.
- #journal! ⇒ Object
- #journaled_app_name ⇒ Object
- #journaled_attributes ⇒ Object
- #journaled_partition_key ⇒ Object
-
#journaled_schema_name ⇒ Object
Event metadata and configuration (not serialized).
Instance Method Details
#created_at ⇒ Object
18 19 20 |
# File 'app/models/journaled/event.rb', line 18 def created_at @created_at ||= Time.zone.now end |
#event_type ⇒ Object
14 15 16 |
# File 'app/models/journaled/event.rb', line 14 def event_type @event_type ||= self.class.event_type end |
#id ⇒ Object
Base attributes
10 11 12 |
# File 'app/models/journaled/event.rb', line 10 def id @id ||= SecureRandom.uuid end |
#journal! ⇒ Object
4 5 6 |
# File 'app/models/journaled/event.rb', line 4 def journal! Journaled::Writer.new(journaled_event: self).journal! end |
#journaled_app_name ⇒ Object
38 39 40 |
# File 'app/models/journaled/event.rb', line 38 def journaled_app_name Journaled.default_app_name end |
#journaled_attributes ⇒ Object
28 29 30 31 32 |
# File 'app/models/journaled/event.rb', line 28 def journaled_attributes self.class.public_send(:journaled_attributes).each_with_object({}) do |attribute, memo| memo[attribute] = public_send(attribute) end end |
#journaled_partition_key ⇒ Object
34 35 36 |
# File 'app/models/journaled/event.rb', line 34 def journaled_partition_key event_type end |
#journaled_schema_name ⇒ Object
Event metadata and configuration (not serialized)
24 25 26 |
# File 'app/models/journaled/event.rb', line 24 def journaled_schema_name self.class.to_s.underscore end |