Module: Journaled::Event

Extended by:
ActiveSupport::Concern
Included in:
Change
Defined in:
app/models/journaled/event.rb

Instance Method Summary collapse

Instance Method Details

#created_atObject



18
19
20
# File 'app/models/journaled/event.rb', line 18

def created_at
  @created_at ||= Time.zone.now
end

#event_typeObject



14
15
16
# File 'app/models/journaled/event.rb', line 14

def event_type
  @event_type ||= self.class.event_type
end

#idObject

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_nameObject



38
39
40
# File 'app/models/journaled/event.rb', line 38

def journaled_app_name
  Journaled.default_app_name
end

#journaled_attributesObject



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_keyObject



34
35
36
# File 'app/models/journaled/event.rb', line 34

def journaled_partition_key
  event_type
end

#journaled_schema_nameObject

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