Module: EvilEvents::Core::Events::EventExtensions::Payloadable::ClassMethods Private
- Defined in:
- lib/evil_events/core/events/event_extensions/payloadable.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #inherited(child_class) ⇒ Object private
-
#payload(key, type = EvilEvents::Types::Any, **options) ⇒ Object
private
Void.
- #payload_class ⇒ Class{AbstractPayload} private
- #payload_fields ⇒ Array<Symbol> private
Instance Method Details
#inherited(child_class) ⇒ Object
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.
30 31 32 33 |
# File 'lib/evil_events/core/events/event_extensions/payloadable.rb', line 30 def inherited(child_class) child_class.const_set(:Payload, Class.new(AbstractPayload)) super end |
#payload(key, type = EvilEvents::Types::Any, **options) ⇒ Object
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 void.
48 49 50 51 52 53 54 |
# File 'lib/evil_events/core/events/event_extensions/payloadable.rb', line 48 def payload(key, type = EvilEvents::Types::Any, **) if type.is_a?(Symbol) type = EvilEvents::Core::Bootstrap[:event_system].resolve_type(type, **) end payload_class.attribute(key, type) end |
#payload_class ⇒ Class{AbstractPayload}
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.
38 39 40 |
# File 'lib/evil_events/core/events/event_extensions/payloadable.rb', line 38 def payload_class const_get(:Payload) end |
#payload_fields ⇒ Array<Symbol>
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.
59 60 61 |
# File 'lib/evil_events/core/events/event_extensions/payloadable.rb', line 59 def payload_fields payload_class.attribute_names end |