Class: Stenotype::EventSerializer
- Inherits:
-
Object
- Object
- Stenotype::EventSerializer
- Defined in:
- lib/stenotype/event_serializer.rb
Overview
A class used to serialize a Event upon publishing it to targets
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#uuid_generator ⇒ Object
readonly
Returns the value of attribute uuid_generator.
Instance Method Summary collapse
-
#initialize(event, uuid_generator: Stenotype.config.uuid_generator) ⇒ EventSerializer
constructor
A new instance of EventSerializer.
-
#serialize ⇒ Hash
A hash representation of the event and its context.
Constructor Details
#initialize(event, uuid_generator: Stenotype.config.uuid_generator) ⇒ EventSerializer
Returns a new instance of EventSerializer.
23 24 25 26 |
# File 'lib/stenotype/event_serializer.rb', line 23 def initialize(event, uuid_generator: Stenotype.config.uuid_generator) @event = event @uuid_generator = uuid_generator end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
9 10 11 |
# File 'lib/stenotype/event_serializer.rb', line 9 def event @event end |
#uuid_generator ⇒ Object (readonly)
Returns the value of attribute uuid_generator.
9 10 11 |
# File 'lib/stenotype/event_serializer.rb', line 9 def uuid_generator @uuid_generator end |
Instance Method Details
#serialize ⇒ Hash
Returns A hash representation of the event and its context.
43 44 45 46 47 48 49 50 |
# File 'lib/stenotype/event_serializer.rb', line 43 def serialize { name: event_name, **event_attributes, **, **, } end |