Module: Outbox::MessageTypes::ClassMethods
- Defined in:
- lib/outbox/message_types.rb
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.
30 31 32 |
# File 'lib/outbox/message_types.rb', line 30 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'
22 23 24 25 26 |
# File 'lib/outbox/message_types.rb', line 22 def (name, ) [name.to_sym] = (name, ) (name) end |