Class: Mantle::MessageHandlers

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/mantle/message_handlers.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash_instance = {}) ⇒ MessageHandlers

Returns a new instance of MessageHandlers.



5
6
7
# File 'lib/mantle/message_handlers.rb', line 5

def initialize(hash_instance = {})
  super hash_instance
end

Instance Method Details

#channelsObject



17
18
19
# File 'lib/mantle/message_handlers.rb', line 17

def channels
  keys
end

#receive_message(channel, message) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/mantle/message_handlers.rb', line 9

def receive_message(channel, message)
  Array(fetch(channel)).each do |string_handler|
    Mantle::Workers::MessageHandlerWorker.perform_async(
      string_handler, channel, message
    )
  end
end