Class: SlideHero::RemoteImage

Inherits:
Object
  • Object
show all
Defined in:
lib/slide_hero/remote_image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_textObject (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

#asObject (readonly)

Returns the value of attribute as.



4
5
6
# File 'lib/slide_hero/remote_image.rb', line 4

def as
  @as
end

#destinationObject (readonly)

Returns the value of attribute destination.



4
5
6
# File 'lib/slide_hero/remote_image.rb', line 4

def destination
  @destination
end

#heightObject (readonly)

Returns the value of attribute height.



4
5
6
# File 'lib/slide_hero/remote_image.rb', line 4

def height
  @height
end

#image_classObject (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

#locationObject (readonly)

Returns the value of attribute location.



4
5
6
# File 'lib/slide_hero/remote_image.rb', line 4

def location
  @location
end

#widthObject (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

#compileObject



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