Class: Jekyll::SrcsetTag::Image::Instance
- Inherits:
-
Object
- Object
- Jekyll::SrcsetTag::Image::Instance
- Defined in:
- lib/jekyll/srcset_tag/image/instance.rb
Instance Attribute Summary collapse
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#image_height ⇒ Object
readonly
Returns the value of attribute image_height.
-
#image_width ⇒ Object
readonly
Returns the value of attribute image_width.
-
#output_height ⇒ Object
readonly
Returns the value of attribute output_height.
-
#output_width ⇒ Object
readonly
Returns the value of attribute output_width.
-
#undersized ⇒ Object
readonly
Returns the value of attribute undersized.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(width:, height:, extension:, image:) ⇒ Instance
constructor
A new instance of Instance.
- #undersized? ⇒ Boolean
Constructor Details
#initialize(width:, height:, extension:, image:) ⇒ Instance
Returns a new instance of Instance.
8 9 10 11 12 13 14 15 16 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 8 def initialize(width:, height:, extension:, image:) @width = width @height = height @extension = extension @image = image @image_width = image[:width].to_i @image_height = image[:height].to_i calculate_output_dimensions! end |
Instance Attribute Details
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def extension @extension end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def height @height end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def image @image end |
#image_height ⇒ Object (readonly)
Returns the value of attribute image_height.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def image_height @image_height end |
#image_width ⇒ Object (readonly)
Returns the value of attribute image_width.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def image_width @image_width end |
#output_height ⇒ Object (readonly)
Returns the value of attribute output_height.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def output_height @output_height end |
#output_width ⇒ Object (readonly)
Returns the value of attribute output_width.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def output_width @output_width end |
#undersized ⇒ Object (readonly)
Returns the value of attribute undersized.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def undersized @undersized end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 5 def width @width end |
Instance Method Details
#filename ⇒ Object
18 19 20 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 18 def filename output_width.to_s + 'x' + output_height.to_s + extension end |
#undersized? ⇒ Boolean
22 23 24 |
# File 'lib/jekyll/srcset_tag/image/instance.rb', line 22 def undersized? @undersized end |