Class: Compass::Core::SassExtensions::Functions::ImageSize::ImageProperties
- Inherits:
-
Object
- Object
- Compass::Core::SassExtensions::Functions::ImageSize::ImageProperties
- Defined in:
- lib/compass/core/sass_extensions/functions/image_size.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ ImageProperties
constructor
A new instance of ImageProperties.
- #size ⇒ Object
Constructor Details
#initialize(file) ⇒ ImageProperties
Returns a new instance of ImageProperties.
17 18 19 20 21 22 23 |
# File 'lib/compass/core/sass_extensions/functions/image_size.rb', line 17 def initialize(file) @file = (file.respond_to?(:to_path) ? file.to_path : file) @file_type = File.extname(@file)[1..-1].downcase unless KNOWN_TYPES.include?(@file_type) raise Sass::SyntaxError, "Unrecognized file type: #{@file_type}" end end |
Instance Method Details
#size ⇒ Object
25 26 27 |
# File 'lib/compass/core/sass_extensions/functions/image_size.rb', line 25 def size @dimensions ||= send(:"get_size_for_#{@file_type}") end |