class Discorb::DefaultAvatar

Represents a default avatar.

Public Class Methods

new(discriminator) click to toggle source

@!visibility private

# File lib/discorb/asset.rb, line 67
def initialize(discriminator)
  @discriminator = discriminator.to_s.rjust(4, "0")
end

Public Instance Methods

animated?() click to toggle source
# File lib/discorb/asset.rb, line 71
def animated?
  false
end
inspect() click to toggle source
# File lib/discorb/asset.rb, line 87
def inspect
  "#<#{self.class} #{@discriminator}>"
end
url(image_format: nil, size: 1024) click to toggle source

Returns the URL of the avatar.

@param [String] image_format The image format. This is compatible with {Asset#url}, will be ignored. @param [Integer] size The size of the image. This is compatible with {Asset#url}, will be ignored.

@return [String] URL of the avatar.

# File lib/discorb/asset.rb, line 83
def url(image_format: nil, size: 1024)
  "https://cdn.discordapp.com/embed/avatars/#{@discriminator.to_i % 5}.png"
end