Class: Core::Models::Chatrooms::Message
- Inherits:
-
Object
- Object
- Core::Models::Chatrooms::Message
- Includes:
- Core::Models::Concerns::Enumerable, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/core/models/chatrooms/message.rb
Overview
This model represents an in-game tchat message sent in the tchat of a campaign.
Instance Attribute Summary collapse
-
#campaign ⇒ Core::Models::Chatrooms::Campaign
The chatroom in which the message has been emitted.
-
#data ⇒ Hash
The additional data passed to the message (arguments of the command, or content of the text).
-
#deleted ⇒ Boolean
TRUE if the message has been marked as deleted by its user, FALSE otherwise.
-
#player ⇒ Core::Models::Account
The account that has emitted the message in the campaign.
-
#raw ⇒ String
The content as typed by the user, without any parsing or transformation.
-
#type ⇒ Symbol
The type of message (plain text or command) contained in the data, used to parse and display it.
Instance Attribute Details
#campaign ⇒ Core::Models::Chatrooms::Campaign
Returns the chatroom in which the message has been emitted.
28 |
# File 'lib/core/models/chatrooms/message.rb', line 28 belongs_to :chatroom, class_name: 'Core::Models::Chatrooms::Campaign', inverse_of: :messages |
#data ⇒ Hash
Returns the additional data passed to the message (arguments of the command, or content of the text).
18 |
# File 'lib/core/models/chatrooms/message.rb', line 18 field :data, type: Hash, default: {} |
#deleted ⇒ Boolean
Returns TRUE if the message has been marked as deleted by its user, FALSE otherwise.
24 |
# File 'lib/core/models/chatrooms/message.rb', line 24 field :deleted, type: Mongoid::Boolean, default: false |
#player ⇒ Core::Models::Account
Returns the account that has emitted the message in the campaign.
31 |
# File 'lib/core/models/chatrooms/message.rb', line 31 belongs_to :account, class_name: 'Core::Models::Account', inverse_of: :messages |
#raw ⇒ String
Returns the content as typed by the user, without any parsing or transformation.
21 |
# File 'lib/core/models/chatrooms/message.rb', line 21 field :raw, type: String, default: '' |
#type ⇒ Symbol
Returns the type of message (plain text or command) contained in the data, used to parse and display it.
15 |
# File 'lib/core/models/chatrooms/message.rb', line 15 enum_field :type, [:text, :command], default: :text |