Class: Campfire::Message
- Inherits:
-
Object
- Object
- Campfire::Message
- Defined in:
- lib/campfire/message.rb
Overview
base message class. All messages have a message_id, timestamp, person (first name of the user generating the message), person_full_name, and body, which is the text of the message
Direct Known Subclasses
AdvertisementMessage, AllowGuestsMessage, ConferenceCreatedMessage, DisallowGuestsMessage, EnterMessage, KickMessage, LeaveMessage, LockMessage, PasteMessage, SoundMessage, TextMessage, TimestampMessage, TopicChangeMessage, TweetMessage, UnlockMessage, UploadMessage
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#person ⇒ Object
Returns the value of attribute person.
-
#person_full_name ⇒ Object
Returns the value of attribute person_full_name.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#type ⇒ Object
Returns the value of attribute type.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(params) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(params) ⇒ Message
Returns a new instance of Message.
10 11 12 13 14 15 |
# File 'lib/campfire/message.rb', line 10 def initialize(params) self. = params[:id] self. = params[:created_at] || Time.now self.body = params[:body] self.type = params[:type].gsub(/(.*?)Message$/, '\1') if params[:type] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
8 9 10 |
# File 'lib/campfire/message.rb', line 8 def body @body end |
#message_id ⇒ Object
Returns the value of attribute message_id.
8 9 10 |
# File 'lib/campfire/message.rb', line 8 def @message_id end |
#person ⇒ Object
Returns the value of attribute person.
8 9 10 |
# File 'lib/campfire/message.rb', line 8 def person @person end |
#person_full_name ⇒ Object
Returns the value of attribute person_full_name.
8 9 10 |
# File 'lib/campfire/message.rb', line 8 def person_full_name @person_full_name end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
8 9 10 |
# File 'lib/campfire/message.rb', line 8 def @timestamp end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/campfire/message.rb', line 8 def type @type end |
#user ⇒ Object
Returns the value of attribute user.
8 9 10 |
# File 'lib/campfire/message.rb', line 8 def user @user end |