Module: Compass::SassExtensions::Sprites::ImageMethods

### Home Classes Methods

### In Files

- lib/compass/sass_extensions/sprites/image_methods.rb

### Methods

- #get_magic_selector_image
- #has_active?
- #has_focus?
- #has_hover?
- #has_target?
- #image_for
- #sprite_names

### Class/Module Index

Quicksearch

- Compass
- Compass::Actions
- Compass::AppIntegration
- Compass::AppIntegration::Helpers
- Compass::AppIntegration::StandAlone
- Compass::AppIntegration::StandAlone::ConfigurationDefaults
- Compass::AppIntegration::StandAlone::Installer
- Compass::Commands
- Compass::Commands::Base
- Compass::Commands::CleanProject
- Compass::Commands::CleanProjectOptionsParser
- Compass::Commands::CompileProjectOptionsParser
- Compass::Commands::ConfigurationOptionsParser
- Compass::Commands::CreateProject
- Compass::Commands::CreateProjectOptionsParser
- Compass::Commands::Default
- Compass::Commands::DefaultOptionsParser
- Compass::Commands::ExtensionCommand
- Compass::Commands::ExtensionOptionsParser
- Compass::Commands::ExtensionsOptionParser
- Compass::Commands::Help
- Compass::Commands::HelpOptionsParser
- Compass::Commands::Imports
- Compass::Commands::InstallerCommand
- Compass::Commands::Interactive
- Compass::Commands::InteractiveOptionsParser
- Compass::Commands::ListFrameworks
- Compass::Commands::PrintVersion
- Compass::Commands::ProjectBase
- Compass::Commands::ProjectStats
- Compass::Commands::Registry
- Compass::Commands::Sprite
- Compass::Commands::SpriteOptionsParser
- Compass::Commands::StampPattern
- Compass::Commands::StampPatternOptionsParser
- Compass::Commands::StatsOptionsParser
- Compass::Commands::StructureOptionsParser
- Compass::Commands::UnpackExtension
- Compass::Commands::UpdateProject
- Compass::Commands::ValidateProject
- Compass::Commands::ValidationOptionsParser
- Compass::Commands::VersionOptionsParser
- Compass::Commands::WriteConfiguration
- Compass::Compiler
- Compass::Configuration
- Compass::Configuration::Comments
- Compass::Configuration::Data
- Compass::Configuration::FileData
- Compass::Configuration::Helpers
- Compass::Configuration::Serialization
- Compass::Deprecation
- Compass::Exec
- Compass::Exec::CommandOptionParser
- Compass::Exec::GlobalOptionsParser
- Compass::Exec::Helpers
- Compass::Exec::ProjectOptionsParser
- Compass::Exec::SubCommandUI
- Compass::FilesystemConflict
- Compass::Installers
- Compass::Installers::BareInstaller
- Compass::Installers::Base
- Compass::Installers::Manifest
- Compass::Installers::Manifest::Entry
- Compass::Installers::ManifestInstaller
- Compass::Installers::TemplateContext
- Compass::Logger
- Compass::MissingDependency
- Compass::NullLogger
- Compass::SassCompiler
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::SassExtensions::Functions::SassDeclarationHelper
- Compass::SassExtensions::Functions::Sprites
- Compass::SassExtensions::Functions::Sprites::VariableReader
- Compass::SassExtensions::Sprites
- Compass::SassExtensions::Sprites::ChunkyPngEngine
- Compass::SassExtensions::Sprites::Engine
- Compass::SassExtensions::Sprites::Image
- Compass::SassExtensions::Sprites::ImageMethods
- Compass::SassExtensions::Sprites::ImageRow
- Compass::SassExtensions::Sprites::Images
- Compass::SassExtensions::Sprites::Layout
- Compass::SassExtensions::Sprites::Layout::Diagonal
- Compass::SassExtensions::Sprites::Layout::Horizontal
- Compass::SassExtensions::Sprites::Layout::Smart
- Compass::SassExtensions::Sprites::Layout::SpriteLayout
- Compass::SassExtensions::Sprites::Layout::Vertical
- Compass::SassExtensions::Sprites::LayoutMethods
- Compass::SassExtensions::Sprites::RowFitter
- Compass::SassExtensions::Sprites::SpriteMap
- Compass::SassExtensions::Sprites::SpriteMethods
- Compass::SpriteException
- Compass::SpriteImporter
- Compass::Sprites
- Compass::Sprites::Binding
- Compass::Stats
- Compass::Stats::CssFile
- Compass::Stats::SassFile
- Compass::Stats::StatsVisitor
- Compass::TestCase
- Compass::Version
- Sass
- Sass::Script
- Sass::Script::Functions
- QuickCache

No matching classes.

# Compass::SassExtensions::Sprites::ImageMethods

### Constants

SEPERATORS

### Public Instance Methods

get_magic_selector_image(name, selector) click to toggle source

    # File lib/compass/sass_extensions/sprites/image_methods.rb, line 36
     def get_magic_selector_image(name, selector)
      SEPERATORS.each do |seperator|
        file = image_for("#{name}#{seperator}#{selector}")
        return file if !file.nil?
      end

      nil
    end

has_active?(name) click to toggle source

Returns true if the image name has an active selector image

    # File lib/compass/sass_extensions/sprites/image_methods.rb, line 30
    def has_active?(name)
      !get_magic_selector_image(name, 'active').nil?
    end

has_focus?(name) click to toggle source

Returns true if the image name has a focus selector image

    # File lib/compass/sass_extensions/sprites/image_methods.rb, line 25
    def has_focus?(name)
      !get_magic_selector_image(name, 'focus').nil?
    end

has_hover?(name) click to toggle source

Returns true if the image name has a hover selector image

    # File lib/compass/sass_extensions/sprites/image_methods.rb, line 15
    def has_hover?(name)
      !get_magic_selector_image(name, 'hover').nil?
    end

has_target?(name) click to toggle source

Returns true if the image name has a target selector image

    # File lib/compass/sass_extensions/sprites/image_methods.rb, line 20
    def has_target?(name)
      !get_magic_selector_image(name, 'target').nil?
    end

image_for(name) click to toggle source

Fetches the Sprite::Image object for the supplied name

    # File lib/compass/sass_extensions/sprites/image_methods.rb, line 6
    def image_for(name)
     if name.is_a?(Sass::Script::Value::String)
       name = name.value
     end
     name = name.to_s
     @images.detect { |img| img.name.downcase == name.downcase}
    end

sprite_names() click to toggle source

Return and array of image names that make up this sprite

    # File lib/compass/sass_extensions/sprites/image_methods.rb, line 46
    def sprite_names
      image_names.map { |f| File.basename(f, '.png') }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.