Rename the sprite Base class to SpriteMap

This commit is contained in:
Chris Eppstein 2011-06-06 18:52:22 -07:00
parent c73d281e58
commit 008cffa3ef
5 changed files with 13 additions and 12 deletions

View File

@ -10,7 +10,7 @@ module Compass::SassExtensions::Functions::Sprites
end
end
# Creates a Compass::SassExtensions::Sprites::Base object. A sprite map, when used in a property is the same
# Creates a Compass::SassExtensions::Sprites::SpriteMap object. A sprite map, when used in a property is the same
# as calling sprite-url. So the following background properties are equivalent:
#
# $icons: sprite-map("icons/*.png");
@ -21,7 +21,7 @@ module Compass::SassExtensions::Functions::Sprites
# the first time it is converted to a url. Simply constructing it has no side-effects.
def sprite_map(glob, kwargs = {})
kwargs.extend VariableReader
Compass::SassExtensions::Sprites::Base.from_uri(glob, self, kwargs)
Compass::SassExtensions::Sprites::SpriteMap.from_uri(glob, self, kwargs)
end
Sass::Script::Functions.declare :sprite_map, [:glob], :var_kwargs => true
@ -160,7 +160,7 @@ protected
end
def verify_map(map, error = "sprite")
unless map.is_a?(Compass::SassExtensions::Sprites::Base)
unless map.is_a?(Compass::SassExtensions::Sprites::SpriteMap)
missing_sprite!(error)
end
end

View File

@ -1,13 +1,14 @@
require 'digest/md5'
require 'compass/sprite_importer'
require 'compass/sass_extensions/sprites/image'
require 'compass/sass_extensions/sprites/base'
require 'compass/sass_extensions/sprites/engines'
module Compass
module SassExtensions
module Sprites
end
end
end
require 'compass/sass_extensions/sprites/image'
require 'compass/sass_extensions/sprites/sprite_map'
require 'compass/sass_extensions/sprites/engines'

View File

@ -1,7 +1,7 @@
module Compass
module SassExtensions
module Sprites
class Base < Sass::Script::Literal
class SpriteMap < Sass::Script::Literal
# Initialize a new sprite object from a relative file path

View File

@ -20,7 +20,7 @@ class SpritesImageTest < Test::Unit::TestCase
def parent
importer = Compass::SpriteImporter.new(:uri => "selectors/*.png", :options => options)
@parent ||= Compass::SassExtensions::Sprites::Base.new(importer.sprite_names.map{|n| "selectors/#{n}.png"}, importer.path, importer.name, importer.sass_engine, importer.options)
@parent ||= Compass::SassExtensions::Sprites::SpriteMap.new(importer.sprite_names.map{|n| "selectors/#{n}.png"}, importer.path, importer.name, importer.sass_engine, importer.options)
end
let(:options) do

View File

@ -1,6 +1,6 @@
require 'test_helper'
class SpritesBaseTest < Test::Unit::TestCase
class SpriteMapTest < Test::Unit::TestCase
def setup
Hash.send(:include, Compass::SassExtensions::Functions::Sprites::VariableReader)
@ -17,7 +17,7 @@ class SpritesBaseTest < Test::Unit::TestCase
def setup_map
@importer = Compass::SpriteImporter.new(:uri => "selectors/*.png", :options => @options)
@base = Compass::SassExtensions::Sprites::Base.new(@importer.sprite_names.map{|n| "selectors/#{n}.png"}, @importer.path, @importer.name, @importer.sass_engine, @importer.options)
@base = Compass::SassExtensions::Sprites::SpriteMap.new(@importer.sprite_names.map{|n| "selectors/#{n}.png"}, @importer.path, @importer.name, @importer.sass_engine, @importer.options)
end
def teardown