Class: Compass::SassExtensions::Functions::ImageSize::ImageProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/compass/sass_extensions/functions/image_size.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ ImageProperties

Returns a new instance of ImageProperties.



15
16
17
18
# File 'lib/compass/sass_extensions/functions/image_size.rb', line 15

def initialize(file)
  @file = (file.respond_to?(:to_path) ? file.to_path : file)
  @file_type = File.extname(@file)[1..-1]
end

Instance Method Details

#sizeObject



20
21
22
23
24
# File 'lib/compass/sass_extensions/functions/image_size.rb', line 20

def size
  @dimensions ||= send(:"get_size_for_#{@file_type}")
rescue NoMethodError
  raise Sass::SyntaxError, "Unrecognized file type: #{@file_type}"
end