Module: Outbox::MessageTypes::ClassMethods
- Defined in:
- lib/outbox/message_types.rb
Constant Summary collapse
- DYNAMIC_MODULE_NAME =
:DynamicMessageTypes
Instance Method Summary collapse
-
#message_types ⇒ Object
Returns a hash of the registred message types, where the key is the name of the message type and the value is the message type class.
-
#register_message_type(name, message_type) ⇒ Object
Registers a message type for sending & creates accessors.
Instance Method Details
#message_types ⇒ Object
Returns a hash of the registred message types, where the key is the name of the message type and the value is the message type class.
36 37 38 |
# File 'lib/outbox/message_types.rb', line 36 def @message_types ||= {} end |
#register_message_type(name, message_type) ⇒ Object
Registers a message type for sending & creates accessors.
Message. :telepathy, TelepathyMessage
= Message.new do
telepathy do
thought 'Hello world.'
end
end
.telepathy.thought #=> 'Hello world.'
Upon deliver the audience object will be checked for the registered message type.
.deliver telepathy: 'Bob'
25 26 27 28 29 30 31 32 |
# File 'lib/outbox/message_types.rb', line 25 def (name, ) [name.to_sym] = (name, ) (name) (name, ) (name, ) (name, ) end |