Class: EventStoreRuby::Event

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

Overview

Base application-level event. Immutable: attributes are frozen after initialization.

Direct Known Subclasses

EventRecord

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_type:, payload: {}) ⇒ Event

Returns a new instance of Event.



7
8
9
10
11
# File 'lib/eventstore_ruby/event.rb', line 7

def initialize(event_type:, payload: {})
  @event_type = event_type.to_s.freeze
  @payload    = payload.freeze
  freeze
end

Instance Attribute Details

#event_typeObject (readonly)

Returns the value of attribute event_type.



5
6
7
# File 'lib/eventstore_ruby/event.rb', line 5

def event_type
  @event_type
end

#payloadObject (readonly)

Returns the value of attribute payload.



5
6
7
# File 'lib/eventstore_ruby/event.rb', line 5

def payload
  @payload
end