Module: Outbox::MessageTypes

Included in:
Message
Defined in:
lib/outbox/message_types.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'lib/outbox/message_types.rb', line 3

def self.included(base)
  base.extend Outbox::DefineInheritableMethod
  base.extend ClassMethods
end

Instance Method Details

#assign_message_type_values(values) ⇒ Object

Assign the given hash where each key is a message type and the value is a hash of options for that message type.



101
102
103
104
105
# File 'lib/outbox/message_types.rb', line 101

def assign_message_type_values(values)
  values.each do |key, value|
    public_send(key, value) if respond_to?(key)
  end
end

#each_message_typeObject

Loops through each registered message type and yields the instance of that type on this message.



109
110
111
112
113
# File 'lib/outbox/message_types.rb', line 109

def each_message_type
  self.class.message_types.each_key do |message_type|
    yield message_type, public_send(message_type)
  end
end