class Sass::Images::Image

Public Class Methods

new(path) click to toggle source
# File lib/sass/images/image.rb, line 5
def initialize(path)
  @path = path.to_s
end

Public Instance Methods

base64() click to toggle source
# File lib/sass/images/image.rb, line 17
def base64
  Base64.encode64(File.read(@path)).gsub("\n", '')
end
content_type() click to toggle source
# 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() click to toggle source
# File lib/sass/images/image.rb, line 13
def height
  metadata[:height]
end
width() click to toggle source
# File lib/sass/images/image.rb, line 9
def width
  metadata[:width]
end

Private Instance Methods

metadata() click to toggle source
# File lib/sass/images/image.rb, line 27
def metadata
  @metadata ||= MiniMagick::Image.open(@path)
end