Class: Discorb::Embed::Field

Inherits:
Entry
  • Object
show all
Defined in:
lib/discorb/embed.rb

Overview

Represents a field of embed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, inline: true) ⇒ Field

Initialize a new Field object.

Parameters:

  • name (String)

    The name of field.

  • value (String)

    The value of field.

  • inline (Boolean) (defaults to: true)

    Whether the field is inline.



248
249
250
251
252
# File 'lib/discorb/embed.rb', line 248

def initialize(name, value, inline: true)
  @name = name
  @value = value
  @inline = inline
end

Instance Attribute Details

#inlineBoolean

Returns Whether the field is inline.

Returns:

  • (Boolean)

    Whether the field is inline.



239
240
241
# File 'lib/discorb/embed.rb', line 239

def inline
  @inline
end

#nameString

Returns The name of field.

Returns:

  • (String)

    The name of field.



235
236
237
# File 'lib/discorb/embed.rb', line 235

def name
  @name
end

#valueString

Returns The value of field.

Returns:

  • (String)

    The value of field.



237
238
239
# File 'lib/discorb/embed.rb', line 237

def value
  @value
end

Instance Method Details

#to_hashHash

Convert field to hash.

Returns:

  • (Hash)

    Converted field.

See Also:



261
262
263
# File 'lib/discorb/embed.rb', line 261

def to_hash
  { name: @name, value: @value, inline: @inline }
end