class Discordrb::Webhooks::EmbedField

A field is a small block of text with a header that can be relatively freely layouted with other fields.

Attributes

inline[RW]

@return [true, false] whether the field should be displayed inline with other fields.

name[RW]

@return [String, nil] name of the field, displayed in bold at the top of the field.

value[RW]

@return [String, nil] value of the field, displayed in normal text below the name.

Public Class Methods

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

Creates a new field object. @param name [String, nil] The name of the field, displayed in bold at the top of the field. @param value [String, nil] The value of the field, displayed in normal text below the name. @param inline [true, false] Whether the field should be displayed inline with other fields.

# File lib/discordrb/webhooks/embeds.rb, line 235
def initialize(name: nil, value: nil, inline: false)
  @name = name
  @value = value
  @inline = inline
end

Public Instance Methods

to_hash() click to toggle source

@return [Hash] a hash representation of this embed field, to be converted to JSON.

# File lib/discordrb/webhooks/embeds.rb, line 242
def to_hash
  {
    name: @name,
    value: @value,
    inline: @inline
  }
end