Class: Discorb::ForumChannel::Tag

Inherits:
DiscordModel show all
Defined in:
lib/discorb/channel/forum.rb

Overview

Represents a tag in the forum channel.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?

Constructor Details

#initialize(name, emoji, moderated: false) -> Discorb::ForumChannel::Tag

Initializes a new tag.

Parameters:

  • name (String)

    The name of the tag.

  • emoji (Discorb::Emoji)

    The emoji of the tag.

  • moderated (Boolean) (defaults to: false)

    Whether the tag is moderated. (aka moderator only)



63
64
65
66
67
68
# File 'lib/discorb/channel/forum.rb', line 63

def initialize(name, emoji, moderated: false)
  @id = nil
  @name = name
  @emoji = emoji
  @moderated = moderated
end

Instance Attribute Details

#emoji -> Discorb::Emoji (readonly)

Returns The emoji of the tag.

Returns:



52
53
54
# File 'lib/discorb/channel/forum.rb', line 52

def emoji
  @emoji
end

#id -> Snowflake (readonly)

Returns The id of the tag.

Returns:



45
46
47
# File 'lib/discorb/channel/forum.rb', line 45

def id
  @id
end

#moderated -> Boolean (readonly) Also known as: moderated?

Returns Whether the tag is moderated. (aka moderator only).

Returns:

  • (Boolean)

    Whether the tag is moderated. (aka moderator only)



49
50
51
# File 'lib/discorb/channel/forum.rb', line 49

def moderated
  @moderated
end

#name -> String (readonly)

Returns The name of the tag.

Returns:

  • (String)

    The name of the tag.



47
48
49
# File 'lib/discorb/channel/forum.rb', line 47

def name
  @name
end

Instance Method Details

#inspect -> Object



86
87
88
# File 'lib/discorb/channel/forum.rb', line 86

def inspect
  "#<#{self.class}: #{name} id=#{id}>"
end

#to_hash -> Hash

Returns the tag as a hash.

Returns:

  • (Hash)

    The tag as a hash.



75
76
77
# File 'lib/discorb/channel/forum.rb', line 75

def to_hash
  { id: id, name: name, moderated: moderated, emoji: emoji }
end