class Discorb::Embed::Image

Represents an image of embed.

Attributes

height[R]

@return [Integer] The height of image. @return [nil] The Image object wasn't created from gateway.

proxy_url[R]

@return [String] The proxy url of image. @return [nil] The Image object wasn't created from gateway.

url[RW]

@return [String] The url of image.

width[R]

@return [Integer] The width of image. @return [nil] The Image object wasn't created from gateway.

Public Class Methods

new(url) click to toggle source

Initialize a new Image object.

@param [String] url URL of image.

# File lib/discorb/embed.rb, line 240
def initialize(url)
  data = url
  if data.is_a? String
    @url = data
  else
    @url = data[:url]
    @proxy_url = data[:proxy_url]
    @height = data[:height]
    @width = data[:width]
  end
end

Public Instance Methods

to_hash() click to toggle source

Convert image to hash for sending.

@see discord.com/developers/docs/resources/channel#embed-object-embed-image-structure Offical Discord API Docs @return [Hash] Converted image.

# File lib/discorb/embed.rb, line 258
def to_hash
  { url: @url }
end