Class: CampfireBot::Message

Inherits:
ActiveSupport::HashWithIndifferentAccess
  • Object
show all
Defined in:
lib/message.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Message

Returns a new instance of Message.



3
4
5
6
7
8
# File 'lib/message.rb', line 3

def initialize(attributes)
  self.merge!(attributes)
  self[:message] = self['body'] if !!self['body']
  self[:person] = self['user']['name'] if !!self['user']
  self[:room] = attributes[:room]
end

Instance Method Details

#paste(str) ⇒ Object



18
19
20
# File 'lib/message.rb', line 18

def paste(str)
  self[:room].paste(str)
end

#play(str) ⇒ Object



26
27
28
# File 'lib/message.rb', line 26

def play(str)
  self[:room].play(str)
end

#reply(str) ⇒ Object



10
11
12
# File 'lib/message.rb', line 10

def reply(str)
  speak(str)
end

#speak(str) ⇒ Object



14
15
16
# File 'lib/message.rb', line 14

def speak(str)
  self[:room].speak(str)
end

#upload(file_path) ⇒ Object



22
23
24
# File 'lib/message.rb', line 22

def upload(file_path)
  self[:room].upload(file_path)
end