Class: Alchemy::Picture::Url
- Inherits:
-
Object
- Object
- Alchemy::Picture::Url
- Defined in:
- app/models/alchemy/picture/url.rb
Instance Attribute Summary collapse
-
#thumb ⇒ Object
readonly
Returns the value of attribute thumb.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
-
#call(params = {}) ⇒ String
The URL to a variant of a picture.
-
#initialize(variant) ⇒ Url
constructor
A new instance of Url.
Constructor Details
#initialize(variant) ⇒ Url
Returns a new instance of Url.
10 11 12 13 14 |
# File 'app/models/alchemy/picture/url.rb', line 10 def initialize(variant) raise ArgumentError, "Variant missing!" if variant.nil? @variant = variant end |
Instance Attribute Details
#thumb ⇒ Object (readonly)
Returns the value of attribute thumb.
6 7 8 |
# File 'app/models/alchemy/picture/url.rb', line 6 def thumb @thumb end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
6 7 8 |
# File 'app/models/alchemy/picture/url.rb', line 6 def variant @variant end |
Instance Method Details
#call(params = {}) ⇒ String
The URL to a variant of a picture
20 21 22 23 24 |
# File 'app/models/alchemy/picture/url.rb', line 20 def call(params = {}) return variant.image.url(params) unless processible_image? "/#{uid}" end |