Class: Firering::Message
- Inherits:
-
Struct
- Object
- Struct
- Firering::Message
- Extended by:
- Instantiator
- Defined in:
- lib/firering/data/message.rb,
lib/firering/data/message.rb
Constant Summary
- MESSAGE_TYPES =
TextMessage
Instance Attribute Summary (collapse)
-
- (Object) body
(also: #to_s)
Returns the value of attribute body.
-
- (Object) connection
Returns the value of attribute connection.
-
- (Object) created_at
Returns the value of attribute created_at.
-
- (Object) id
Returns the value of attribute id.
-
- (Object) room_id
Returns the value of attribute room_id.
-
- (Object) type
Returns the value of attribute type.
-
- (Object) user_id
Returns the value of attribute user_id.
Instance Method Summary (collapse)
- - (Boolean) from_user?
- - (Object) room(&callback)
-
- (Object) star(id, yes_or_no = true, &callback)
Highlights a message / Removes a message highlight.
- - (Object) user(&callback)
Methods included from Instantiator
Instance Attribute Details
- (Object) body Also known as: to_s
Returns the value of attribute body
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def body @body end |
- (Object) connection
Returns the value of attribute connection
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def connection @connection end |
- (Object) created_at
Returns the value of attribute created_at
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def created_at @created_at end |
- (Object) id
Returns the value of attribute id
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def id @id end |
- (Object) room_id
Returns the value of attribute room_id
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def room_id @room_id end |
- (Object) type
Returns the value of attribute type
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def type @type end |
- (Object) user_id
Returns the value of attribute user_id
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def user_id @user_id end |
Instance Method Details
- (Boolean) from_user?
29 30 31 |
# File 'lib/firering/data/message.rb', line 29 def from_user? !user_id.nil? && (!user_id.instance_of?(String) || user_id !~ /^\s*$/) end |
- (Object) room(&callback)
38 39 40 |
# File 'lib/firering/data/message.rb', line 38 def room(&callback) connection.room(room_id, &callback) end |
- (Object) star(id, yes_or_no = true, &callback)
Highlights a message / Removes a message highlight.
34 35 36 |
# File 'lib/firering/data/message.rb', line 34 def star(id, yes_or_no = true, &callback) connection.(id, yes_or_no, &callback) end |
- (Object) user(&callback)
42 43 44 45 46 47 48 |
# File 'lib/firering/data/message.rb', line 42 def user(&callback) if from_user? connection.user(user_id, &callback) else callback.call(nil, connection) end end |