Class: MijDiscord::Data::EmbedField

Inherits:
Object
  • Object
show all
Defined in:
lib/mij-discord/data/embed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ EmbedField

Returns a new instance of EmbedField.



211
212
213
# File 'lib/mij-discord/data/embed.rb', line 211

def initialize(data)
  @name, @value, @inline = data['name'], data['value'], data['inline']
end

Instance Attribute Details

#inlineObject (readonly)

Returns the value of attribute inline.



209
210
211
# File 'lib/mij-discord/data/embed.rb', line 209

def inline
  @inline
end

#nameObject (readonly)

Returns the value of attribute name.



205
206
207
# File 'lib/mij-discord/data/embed.rb', line 205

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



207
208
209
# File 'lib/mij-discord/data/embed.rb', line 207

def value
  @value
end

Instance Method Details

#inspectObject



215
216
217
# File 'lib/mij-discord/data/embed.rb', line 215

def inspect
  MijDiscord.make_inspect(self, :name, :value, :inline)
end

#to_hashObject



219
220
221
222
223
224
225
# File 'lib/mij-discord/data/embed.rb', line 219

def to_hash
  {
    'name' => @name,
    'value' => @value,
    'inline' => @inline,
  }.delete_if {|_,v| v.nil? }
end