Class: EventStoreRuby::EventRecord

Inherits:
Event
  • Object
show all
Defined in:
lib/eventstore_ruby/event.rb

Overview

Persisted event enriched with sequence number and timestamp.

Instance Attribute Summary collapse

Attributes inherited from Event

#event_type, #payload

Instance Method Summary collapse

Constructor Details

#initialize(sequence_number:, timestamp: Time.now, event_type:, payload: {}) ⇒ EventRecord



18
19
20
21
22
# File 'lib/eventstore_ruby/event.rb', line 18

def initialize(sequence_number:, timestamp: Time.now, event_type:, payload: {})
  @sequence_number = Integer(sequence_number)
  @timestamp       = timestamp
  super(event_type: event_type, payload: payload)
end

Instance Attribute Details

#sequence_numberObject (readonly)

Returns the value of attribute sequence_number.



16
17
18
# File 'lib/eventstore_ruby/event.rb', line 16

def sequence_number
  @sequence_number
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



16
17
18
# File 'lib/eventstore_ruby/event.rb', line 16

def timestamp
  @timestamp
end