class Discorb::Embed::Field

Represents a field of embed.

Attributes

inline[RW]

@return [Boolean] Whether the field is inline.

name[RW]

@return [String] The name of field.

value[RW]

@return [String] The value of field.

Public Class Methods

new(name, value, inline: true) click to toggle source

Initialize a new Field object.

@param [String] name The name of field. @param [String] value The value of field. @param [Boolean] inline Whether the field is inline.

# File lib/discorb/embed.rb, line 198
def initialize(name, value, inline: true)
  @name = name
  @value = value
  @inline = inline
end

Public Instance Methods

to_hash() click to toggle source

Convert field to hash.

@see discord.com/developers/docs/resources/channel#embed-object-embed-field-structure Offical Discord API Docs @return [Hash] Converted field.

# File lib/discorb/embed.rb, line 210
def to_hash
  {
    name: @name,
    value: @value,
    inline: @inline,
  }
end