Class: MijDiscord::Data::EmbedMedia

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) ⇒ EmbedMedia

Returns a new instance of EmbedMedia.



138
139
140
141
# File 'lib/mij-discord/data/embed.rb', line 138

def initialize(data)
  @url, @width, @height = data['url'], data['width'], data['height']
  @proxy_url = data['proxy_url']
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



136
137
138
# File 'lib/mij-discord/data/embed.rb', line 136

def height
  @height
end

#proxy_urlObject (readonly)

Returns the value of attribute proxy_url.



132
133
134
# File 'lib/mij-discord/data/embed.rb', line 132

def proxy_url
  @proxy_url
end

#urlObject (readonly)

Returns the value of attribute url.



130
131
132
# File 'lib/mij-discord/data/embed.rb', line 130

def url
  @url
end

#widthObject (readonly)

Returns the value of attribute width.



134
135
136
# File 'lib/mij-discord/data/embed.rb', line 134

def width
  @width
end

Instance Method Details

#inspectObject



143
144
145
# File 'lib/mij-discord/data/embed.rb', line 143

def inspect
  MijDiscord.make_inspect(self, :url, :width, :height)
end

#to_hashObject



147
148
149
150
151
152
153
# File 'lib/mij-discord/data/embed.rb', line 147

def to_hash
  {
    'url' => @url,
    'width' => @width,
    'height' => @height,
  }.delete_if {|_,v| v.nil? }
end