Class: Jekyll::Images::Image
- Inherits:
-
Object
- Object
- Jekyll::Images::Image
- Defined in:
- lib/jekyll/images/image.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(site, filename) ⇒ Image
constructor
A new instance of Image.
- #thumbnail(**args) ⇒ Object
Constructor Details
#initialize(site, filename) ⇒ Image
Returns a new instance of Image.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jekyll/images/image.rb', line 10 def initialize(site, filename) unless File.exist? filename raise ArgumentError, "File not found: #{filename}" end @cached_thumbnails = {} @site = site @filename = filename # We only need the image to get height and width image = Vips::Image.new_from_file filename, access: :sequential @height = image.height @width = image.width end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/jekyll/images/image.rb', line 8 def filename @filename end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
8 9 10 |
# File 'lib/jekyll/images/image.rb', line 8 def height @height end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
8 9 10 |
# File 'lib/jekyll/images/image.rb', line 8 def site @site end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
8 9 10 |
# File 'lib/jekyll/images/image.rb', line 8 def width @width end |