Class: Flamethrower::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/flamethrower/dispatcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Dispatcher

Returns a new instance of Dispatcher.



5
6
7
# File 'lib/flamethrower/dispatcher.rb', line 5

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



3
4
5
# File 'lib/flamethrower/dispatcher.rb', line 3

def connection
  @connection
end

Instance Method Details

#handle_message(message) ⇒ Object



9
10
11
12
# File 'lib/flamethrower/dispatcher.rb', line 9

def handle_message(message)
  method = "handle_#{message.command.downcase}"
  send(method, message) if protected_methods.map(&:to_s).include?(method)
end