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

Instance Method Details

#created_atObject



20
21
22
# File 'app/models/journaled/event.rb', line 20

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

#event_typeObject



16
17
18
# File 'app/models/journaled/event.rb', line 16

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

#idObject

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_attributesObject



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_keyObject



36
37
38
# File 'app/models/journaled/event.rb', line 36

def journaled_partition_key
  event_type
end

#journaled_schema_nameObject

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_nameObject



40
41
42
# File 'app/models/journaled/event.rb', line 40

def journaled_stream_name
  Journaled.default_stream_name
end

#tagged?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/models/journaled/event.rb', line 44

def tagged?
  false
end