Class: EvilEvents::Core::Events::AbstractEvent Abstract Private

Inherits:
Object
  • Object
show all
Extended by:
Symbiont::Context
Includes:
EventExtensions::ClassSignature, EventExtensions::Dispatchable, EventExtensions::Hookable, EventExtensions::Manageable, EventExtensions::MetadataExtendable, EventExtensions::Observable, EventExtensions::Payloadable, EventExtensions::Serializable, EventExtensions::TypeAliasing
Defined in:
lib/evil_events/core/events/abstract_event.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is abstract.

Since:

  • 0.1.0

Constant Summary

Constants included from EventExtensions::MetadataExtendable

EventExtensions::MetadataExtendable::AbstractMetadata

Constants included from EventExtensions::Payloadable

EventExtensions::Payloadable::AbstractPayload

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EventExtensions::Dispatchable

#adapter, #adapter_name, #emit!, included

Methods included from EventExtensions::Hookable

#__call_after_hooks__, #__call_before_hooks__, #__call_on_error_hooks__, #call, included

Methods included from EventExtensions::ClassSignature

included, #similar_to?

Methods included from EventExtensions::MetadataExtendable

#build_metadata, included

Methods included from EventExtensions::Serializable

#serialize_to_hash, #serialize_to_json, #serialize_to_msgpack, #serialize_to_xml

Methods included from EventExtensions::Observable

included, #observers

Methods included from EventExtensions::Manageable

included

Methods included from EventExtensions::Payloadable

#build_payload, included

Methods included from EventExtensions::TypeAliasing

included, #type

Constructor Details

#initialize(id: nil, payload: {}, metadata: {}) ⇒ AbstractEvent

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of AbstractEvent.

Parameters:

  • payload (Hash) (defaults to: {})

    a customizable set of options

  • metadata (Hash) (defaults to: {})

    a customizable set of options

Options Hash (payload:):

  • (Hash)

Options Hash (metadata:):

  • (Hash)

Since:

  • 0.1.0



39
40
41
42
43
# File 'lib/evil_events/core/events/abstract_event.rb', line 39

def initialize(id: nil, payload: {}, metadata: {})
  @id       = id || EvilEvents::Shared::Crypto.uuid
  @payload  = build_payload(**payload)
  @metadata = (**)
end

Instance Attribute Details

#idString (readonly)

Returns:

  • (String)

Since:

  • 0.1.0



33
34
35
# File 'lib/evil_events/core/events/abstract_event.rb', line 33

def id
  @id
end

Instance Method Details

#metadataHash

Returns:

  • (Hash)

Since:

  • 0.1.0



57
58
59
# File 'lib/evil_events/core/events/abstract_event.rb', line 57

def 
  @metadata.to_h
end

#payloadHash

Returns:

  • (Hash)

Since:

  • 0.1.0



49
50
51
# File 'lib/evil_events/core/events/abstract_event.rb', line 49

def payload
  @payload.to_h
end