Class: Sass::Images::Image
- Inherits:
-
Object
- Object
- Sass::Images::Image
- Defined in:
- lib/sass/images/image.rb
Instance Method Summary collapse
- #base64 ⇒ Object
- #content_type ⇒ Object
- #height ⇒ Object
-
#initialize(path) ⇒ Image
constructor
A new instance of Image.
- #width ⇒ Object
Constructor Details
#initialize(path) ⇒ Image
Returns a new instance of Image.
5 6 7 |
# File 'lib/sass/images/image.rb', line 5 def initialize(path) @path = path.to_s end |
Instance Method Details
#base64 ⇒ Object
17 18 19 |
# File 'lib/sass/images/image.rb', line 17 def base64 Base64.encode64(File.read(@path)).gsub("\n", '') end |
#content_type ⇒ Object
21 22 23 |
# File 'lib/sass/images/image.rb', line 21 def content_type MIME::Types.type_for(@path)[0].content_type.force_encoding 'UTF-8' end |
#height ⇒ Object
13 14 15 |
# File 'lib/sass/images/image.rb', line 13 def height [:height] end |
#width ⇒ Object
9 10 11 |
# File 'lib/sass/images/image.rb', line 9 def width [:width] end |