Class: SlideHero::RemoteImage
- Inherits:
-
Object
- Object
- SlideHero::RemoteImage
- Defined in:
- lib/slide_hero/remote_image.rb
Instance Attribute Summary collapse
-
#alt_text ⇒ Object
readonly
Returns the value of attribute alt_text.
-
#as ⇒ Object
readonly
Returns the value of attribute as.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#image_class ⇒ Object
readonly
Returns the value of attribute image_class.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(location, alt_text = "", image_class: Image, width: nil, height: nil, destination: 'images', as: nil) ⇒ RemoteImage
constructor
A new instance of RemoteImage.
Constructor Details
#initialize(location, alt_text = "", image_class: Image, width: nil, height: nil, destination: 'images', as: nil) ⇒ RemoteImage
Returns a new instance of RemoteImage.
5 6 7 8 9 10 11 12 13 |
# File 'lib/slide_hero/remote_image.rb', line 5 def initialize(location, alt_text="", image_class:Image, width:nil, height:nil, destination: 'images', as:nil) @location = location @alt_text = alt_text @width = width @height = height @image_class = image_class @destination = destination @as = as end |
Instance Attribute Details
#alt_text ⇒ Object (readonly)
Returns the value of attribute alt_text.
4 5 6 |
# File 'lib/slide_hero/remote_image.rb', line 4 def alt_text @alt_text end |
#as ⇒ Object (readonly)
Returns the value of attribute as.
4 5 6 |
# File 'lib/slide_hero/remote_image.rb', line 4 def as @as end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
4 5 6 |
# File 'lib/slide_hero/remote_image.rb', line 4 def destination @destination end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
4 5 6 |
# File 'lib/slide_hero/remote_image.rb', line 4 def height @height end |
#image_class ⇒ Object (readonly)
Returns the value of attribute image_class.
4 5 6 |
# File 'lib/slide_hero/remote_image.rb', line 4 def image_class @image_class end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
4 5 6 |
# File 'lib/slide_hero/remote_image.rb', line 4 def location @location end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
4 5 6 |
# File 'lib/slide_hero/remote_image.rb', line 4 def width @width end |
Instance Method Details
#compile ⇒ Object
15 16 17 18 |
# File 'lib/slide_hero/remote_image.rb', line 15 def compile fetch_remote_file unless file_cached? image_class.new(filename, alt_text, width: width, height:height).compile end |