Module: Journaled::Event
- Extended by:
- ActiveSupport::Concern
- Included in:
- AuditLog::Event, Change
- Defined in:
- app/models/journaled/event.rb
Defined Under Namespace
Modules: Tagged
Instance Method Summary collapse
- #created_at ⇒ Object
- #event_type ⇒ Object
-
#id ⇒ Object
Base attributes.
- #journal! ⇒ Object
- #journaled_attributes ⇒ Object
- #journaled_partition_key ⇒ Object
-
#journaled_schema_name ⇒ Object
Event metadata and configuration (not serialized).
- #journaled_stream_name ⇒ Object
- #tagged? ⇒ Boolean
Instance Method Details
#created_at ⇒ Object
20 21 22 |
# File 'app/models/journaled/event.rb', line 20 def created_at @created_at ||= Time.zone.now end |
#event_type ⇒ Object
16 17 18 |
# File 'app/models/journaled/event.rb', line 16 def event_type @event_type ||= self.class.event_type end |
#id ⇒ Object
Base attributes
12 13 14 |
# File 'app/models/journaled/event.rb', line 12 def id @id ||= SecureRandom.uuid end |
#journal! ⇒ Object
6 7 8 |
# File 'app/models/journaled/event.rb', line 6 def journal! Journaled::Writer.new(journaled_event: self).journal! end |
#journaled_attributes ⇒ Object
30 31 32 33 34 |
# File 'app/models/journaled/event.rb', line 30 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
36 37 38 |
# File 'app/models/journaled/event.rb', line 36 def journaled_partition_key event_type end |
#journaled_schema_name ⇒ Object
Event metadata and configuration (not serialized)
26 27 28 |
# File 'app/models/journaled/event.rb', line 26 def journaled_schema_name self.class.to_s.underscore end |
#journaled_stream_name ⇒ Object
40 41 42 |
# File 'app/models/journaled/event.rb', line 40 def journaled_stream_name Journaled.default_stream_name end |
#tagged? ⇒ Boolean
44 45 46 |
# File 'app/models/journaled/event.rb', line 44 def tagged? false end |