Class: Poundie::Campfire::Message
- Inherits:
-
Object
- Object
- Poundie::Campfire::Message
- Defined in:
- lib/poundie/campfire/message.rb
Instance Method Summary collapse
- #body ⇒ Object
- #created_at ⇒ Object
- #id ⇒ Object
-
#initialize(room, hash) ⇒ Message
constructor
A new instance of Message.
- #paste? ⇒ Boolean
- #room_id ⇒ Object
- #sound? ⇒ Boolean
- #text? ⇒ Boolean
- #timestamp? ⇒ Boolean
- #tweet? ⇒ Boolean
- #type ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(room, hash) ⇒ Message
Returns a new instance of Message.
4 5 6 |
# File 'lib/poundie/campfire/message.rb', line 4 def initialize(room, hash) @room, @hash = room, hash end |
Instance Method Details
#body ⇒ Object
12 13 14 |
# File 'lib/poundie/campfire/message.rb', line 12 def body @hash[:body] end |
#created_at ⇒ Object
20 21 22 |
# File 'lib/poundie/campfire/message.rb', line 20 def created_at @hash[:created_at] end |
#id ⇒ Object
8 9 10 |
# File 'lib/poundie/campfire/message.rb', line 8 def id @hash[:id] end |
#paste? ⇒ Boolean
36 37 38 |
# File 'lib/poundie/campfire/message.rb', line 36 def paste? type == "PasteMessage" end |
#room_id ⇒ Object
16 17 18 |
# File 'lib/poundie/campfire/message.rb', line 16 def room_id @hash[:room_id] end |
#sound? ⇒ Boolean
40 41 42 |
# File 'lib/poundie/campfire/message.rb', line 40 def sound? type == "SoundMessage" end |
#text? ⇒ Boolean
32 33 34 |
# File 'lib/poundie/campfire/message.rb', line 32 def text? type == "TextMessage" end |
#timestamp? ⇒ Boolean
48 49 50 |
# File 'lib/poundie/campfire/message.rb', line 48 def type == "TimestampMessage" end |
#tweet? ⇒ Boolean
44 45 46 |
# File 'lib/poundie/campfire/message.rb', line 44 def tweet? type == "TweetMessage" end |
#type ⇒ Object
28 29 30 |
# File 'lib/poundie/campfire/message.rb', line 28 def type @hash[:type] end |
#user ⇒ Object
24 25 26 |
# File 'lib/poundie/campfire/message.rb', line 24 def user Poundie::Campfire::User.get(@room, @hash[:user_id]) end |