Class: RubyCord::Asset
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- RubyCord::Asset
- Defined in:
- lib/rubycord/asset.rb
Overview
Represents a single asset.
Instance Attribute Summary collapse
-
#animated? ⇒ Boolean
readonly
return [Boolean].
-
#hash ⇒ String
readonly
The hash of asset.
Instance Method Summary collapse
-
#inspect ⇒ String
Object class and attributes.
-
#url(image_format: nil, size: 1024) ⇒ String
URL of the asset.
Methods inherited from DiscordModel
Instance Attribute Details
#animated? ⇒ Boolean (readonly)
return [Boolean]
|
# File 'lib/rubycord/asset.rb', line 11
|
#hash ⇒ String (readonly)
Returns The hash of asset.
9 10 11 |
# File 'lib/rubycord/asset.rb', line 9 def hash @hash end |
Instance Method Details
#inspect ⇒ String
Returns Object class and attributes.
47 48 49 |
# File 'lib/rubycord/asset.rb', line 47 def inspect "#<#{self.class} #{@target.class} #{@hash}>" end |
#url(image_format: nil, size: 1024) ⇒ String
URL of the asset.
41 42 43 44 |
# File 'lib/rubycord/asset.rb', line 41 def url(image_format: nil, size: 1024) path = @path || "#{endpoint}/#{@target.id}" "https://cdn.discordapp.com/#{path}/#{@hash}.#{image_format or (animated? ? "gif" : "webp")}?size=#{size}" end |