Class: Smackr::Chat::MessageReceiver

Inherits:
Object
  • Object
show all
Defined in:
lib/smackr/chat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ MessageReceiver

Returns a new instance of MessageReceiver.



33
34
35
# File 'lib/smackr/chat.rb', line 33

def initialize(opts={})
  self.chat = opts[:chat]
end

Instance Attribute Details

#chatObject

Returns the value of attribute chat.



32
33
34
# File 'lib/smackr/chat.rb', line 32

def chat
  @chat
end

Instance Method Details

#process_message(conn, msg) ⇒ Object



36
37
38
39
# File 'lib/smackr/chat.rb', line 36

def process_message(conn, msg)
  chat.messages << msg
  chat.message_callback.call(conn, msg) if chat.message_callback
end