Class: Rubycord::Webhooks::EmbedField
- Inherits:
-
Object
- Object
- Rubycord::Webhooks::EmbedField
- Defined in:
- lib/rubycord/webhooks/embeds.rb
Overview
A field is a small block of text with a header that can be relatively freely layouted with other fields.
Instance Attribute Summary collapse
-
#inline ⇒ true, false
Whether the field should be displayed inline with other fields.
-
#name ⇒ String?
Name of the field, displayed in bold at the top of the field.
-
#value ⇒ String?
Value of the field, displayed in normal text below the name.
Instance Method Summary collapse
-
#initialize(name: nil, value: nil, inline: false) ⇒ EmbedField
constructor
Creates a new field object.
-
#to_hash ⇒ Hash
A hash representation of this embed field, to be converted to JSON.
Constructor Details
#initialize(name: nil, value: nil, inline: false) ⇒ EmbedField
Creates a new field object.
233 234 235 236 237 |
# File 'lib/rubycord/webhooks/embeds.rb', line 233 def initialize(name: nil, value: nil, inline: false) @name = name @value = value @inline = inline end |
Instance Attribute Details
#inline ⇒ true, false
Returns whether the field should be displayed inline with other fields.
227 228 229 |
# File 'lib/rubycord/webhooks/embeds.rb', line 227 def inline @inline end |
#name ⇒ String?
Returns name of the field, displayed in bold at the top of the field.
221 222 223 |
# File 'lib/rubycord/webhooks/embeds.rb', line 221 def name @name end |
#value ⇒ String?
Returns value of the field, displayed in normal text below the name.
224 225 226 |
# File 'lib/rubycord/webhooks/embeds.rb', line 224 def value @value end |
Instance Method Details
#to_hash ⇒ Hash
Returns a hash representation of this embed field, to be converted to JSON.
240 241 242 243 244 245 246 |
# File 'lib/rubycord/webhooks/embeds.rb', line 240 def to_hash { name: @name, value: @value, inline: @inline } end |