Class: Core::Models::Chatrooms::Message

Inherits:
Object
  • Object
show all
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.

Author:

Instance Attribute Summary collapse

Instance Attribute Details

#campaignCore::Models::Chatrooms::Campaign

Returns the chatroom in which the message has been emitted.

Returns:



28
# File 'lib/core/models/chatrooms/message.rb', line 28

belongs_to :chatroom, class_name: 'Core::Models::Chatrooms::Campaign', inverse_of: :messages

#dataHash

Returns the additional data passed to the message (arguments of the command, or content of the text).

Returns:

  • (Hash)

    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: {}

#deletedBoolean

Returns TRUE if the message has been marked as deleted by its user, FALSE otherwise.

Returns:

  • (Boolean)

    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

#playerCore::Models::Account

Returns the account that has emitted the message in the campaign.

Returns:



31
# File 'lib/core/models/chatrooms/message.rb', line 31

belongs_to :account, class_name: 'Core::Models::Account', inverse_of: :messages

#rawString

Returns the content as typed by the user, without any parsing or transformation.

Returns:

  • (String)

    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: ''

#typeSymbol

Returns the type of message (plain text or command) contained in the data, used to parse and display it.

Returns:

  • (Symbol)

    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