Module: Compass::SassExtensions::Sprites::ImageMethods
- Included in:
- SpriteMap
- Defined in:
- lib/compass/sass_extensions/sprites/image_methods.rb
Instance Method Summary collapse
-
#has_active?(name) ⇒ Boolean
Returns true if the image name has an active selector image.
-
#has_hover?(name) ⇒ Boolean
Returns true if the image name has a hover selector image.
-
#has_target?(name) ⇒ Boolean
Returns true if the image name has a target selector image.
-
#image_for(name) ⇒ Object
Fetches the Sprite::Image object for the supplied name.
-
#sprite_names ⇒ Object
Return and array of image names that make up this sprite.
Instance Method Details
#has_active?(name) ⇒ Boolean
Returns true if the image name has an active selector image
21 22 23 |
# File 'lib/compass/sass_extensions/sprites/image_methods.rb', line 21 def has_active?(name) !image_for("#{name}_active").nil? end |
#has_hover?(name) ⇒ Boolean
Returns true if the image name has a hover selector image
11 12 13 |
# File 'lib/compass/sass_extensions/sprites/image_methods.rb', line 11 def has_hover?(name) !image_for("#{name}_hover").nil? end |
#has_target?(name) ⇒ Boolean
Returns true if the image name has a target selector image
16 17 18 |
# File 'lib/compass/sass_extensions/sprites/image_methods.rb', line 16 def has_target?(name) !image_for("#{name}_target").nil? end |
#image_for(name) ⇒ Object
Fetches the Sprite::Image object for the supplied name
6 7 8 |
# File 'lib/compass/sass_extensions/sprites/image_methods.rb', line 6 def image_for(name) @images.detect { |img| img.name == name} end |
#sprite_names ⇒ Object
Return and array of image names that make up this sprite
26 27 28 |
# File 'lib/compass/sass_extensions/sprites/image_methods.rb', line 26 def sprite_names image_names.map { |f| File.basename(f, '.png') } end |