added engine to sprite_map

This commit is contained in:
Scott Davis 2011-06-12 01:35:50 -04:00
parent b6cf4f5213
commit 80412b5c1d

View File

@ -3,7 +3,7 @@ module Compass
module Sprites module Sprites
class SpriteMap < Sass::Script::Literal class SpriteMap < Sass::Script::Literal
attr_accessor :image_names, :path, :name, :map, :kwargs attr_accessor :image_names, :path, :name, :map, :kwargs
attr_accessor :images, :width, :height attr_accessor :images, :width, :height, :engine
include SpriteMethods include SpriteMethods
include ImageMethods include ImageMethods
@ -20,7 +20,6 @@ module Compass
end end
def initialize(sprites, path, name, context, kwargs) def initialize(sprites, path, name, context, kwargs)
require_engine!
@image_names = sprites @image_names = sprites
@path = path @path = path
@name = name @name = name
@ -29,16 +28,12 @@ module Compass
@images = nil @images = nil
@width = nil @width = nil
@height = nil @height = nil
@engine = nil
@evaluation_context = context @evaluation_context = context
validate! validate!
compute_image_metadata! compute_image_metadata!
end end
# Loads the sprite engine
def require_engine!
self.class.send(:include, eval("::Compass::SassExtensions::Sprites::#{modulize}Engine"))
end
def inspect def inspect
to_s to_s
end end