Sha256: 5320730d7d5748e0a3ed515463298d8207fd28b9abd1898111fe190df5a9f828

Contents?: true

Size: 916 Bytes

Versions: 27

Compression:

Stored size: 916 Bytes

Contents

module Compass
  module SassExtensions
    module Sprites
      module ImageMethods
        # Fetches the Sprite::Image object for the supplied name
         def image_for(name)
           @images.detect { |img| img.name == name}
         end

         # Returns true if the image name has a hover selector image
         def has_hover?(name)
           !image_for("#{name}_hover").nil?
         end

         # Returns true if the image name has a target selector image
         def has_target?(name)
           !image_for("#{name}_target").nil?
         end

         # Returns true if the image name has an active selector image
         def has_active?(name)
           !image_for("#{name}_active").nil?
         end

         # Return and array of image names that make up this sprite
         def sprite_names
           image_names.map { |f| File.basename(f, '.png') }
         end
      end
    end
  end
end

Version data entries

27 entries across 26 versions & 5 rubygems

Version Path
compass-0.12.7 lib/compass/sass_extensions/sprites/image_methods.rb
sadui-0.0.4 vendor/bundle/ruby/2.1.0/gems/compass-0.12.3/lib/compass/sass_extensions/sprites/image_methods.rb
sadui-0.0.4 vendor/bundle/ruby/2.0.0/gems/compass-0.12.3/lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.6 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.5 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.4 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.3 lib/compass/sass_extensions/sprites/image_methods.rb
compass-sourcemaps-0.12.4.sourcemaps.a4836f1 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.2 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.2.rc.1 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.2.rc.0 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.1 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.0 lib/compass/sass_extensions/sprites/image_methods.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/compass-0.11.7/lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.rc.1 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.rc.0 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.11.7 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.alpha.4 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.12.alpha.3 lib/compass/sass_extensions/sprites/image_methods.rb
compass-0.11.6 lib/compass/sass_extensions/sprites/image_methods.rb