Module: Compass::Configuration::Inheritance::ClassMethods

### Home Classes Methods

### In Files

- lib/compass/configuration/inheritance.rb

### Namespace

- CLASS Compass::Configuration::Inheritance::ClassMethods::ArrayProxy

### Methods

- #chained_method
- #inherited_accessor
- #inherited_array
- #inherited_reader
- #inherited_writer

### Class/Module Index

Quicksearch

- Compass
- Compass::Actions
- Compass::AppIntegration
- Compass::AppIntegration::Helpers
- Compass::AppIntegration::Rails
- Compass::AppIntegration::StandAlone
- Compass::AppIntegration::StandAlone::ConfigurationDefaults
- Compass::AppIntegration::StandAlone::Installer
- Compass::BrowserSupport
- 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::GenerateGridBackground
- Compass::Commands::GridBackgroundOptionsParser
- Compass::Commands::Help
- Compass::Commands::HelpOptionsParser
- Compass::Commands::Imports
- Compass::Commands::InstallerCommand
- Compass::Commands::Interactive
- Compass::Commands::InteractiveOptionsParser
- Compass::Commands::ListFrameworks
- Compass::Commands::MemoryDebugger
- 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::WatchProject
- Compass::Commands::WatchProjectOptionsParser
- Compass::Commands::WriteConfiguration
- Compass::Compiler
- Compass::Configuration
- Compass::Configuration::Adapters
- Compass::Configuration::Comments
- Compass::Configuration::Data
- Compass::Configuration::Defaults
- Compass::Configuration::FileData
- Compass::Configuration::Helpers
- Compass::Configuration::Inheritance
- Compass::Configuration::Inheritance::ClassMethods
- Compass::Configuration::Inheritance::ClassMethods::ArrayProxy
- Compass::Configuration::Inheritance::InstanceMethods
- Compass::Configuration::Paths
- Compass::Configuration::Serialization
- Compass::Error
- Compass::Exec
- Compass::Exec::CommandOptionParser
- Compass::Exec::GlobalOptionsParser
- Compass::Exec::Helpers
- Compass::Exec::ProjectOptionsParser
- Compass::Exec::SubCommandUI
- Compass::Exec::SwitchUI
- Compass::FilesystemConflict
- Compass::Frameworks
- Compass::Frameworks::Framework
- Compass::GridBuilder
- 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::PNG
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::SassExtensions::Functions::Colors
- Compass::SassExtensions::Functions::Constants
- Compass::SassExtensions::Functions::CrossBrowserSupport
- Compass::SassExtensions::Functions::CrossBrowserSupport::CSS2FallbackValue
- Compass::SassExtensions::Functions::Display
- Compass::SassExtensions::Functions::Enumerate
- Compass::SassExtensions::Functions::Env
- Compass::SassExtensions::Functions::FontFiles
- Compass::SassExtensions::Functions::GradientSupport
- Compass::SassExtensions::Functions::GradientSupport::Assertions
- Compass::SassExtensions::Functions::GradientSupport::ColorStop
- Compass::SassExtensions::Functions::GradientSupport::Functions
- Compass::SassExtensions::Functions::GradientSupport::Gradient
- Compass::SassExtensions::Functions::GradientSupport::Gradient::ClassMethods
- Compass::SassExtensions::Functions::GradientSupport::LinearGradient
- Compass::SassExtensions::Functions::GradientSupport::RadialGradient
- Compass::SassExtensions::Functions::ImageSize
- Compass::SassExtensions::Functions::ImageSize::ImageProperties
- Compass::SassExtensions::Functions::ImageSize::JPEG
- Compass::SassExtensions::Functions::InlineImage
- Compass::SassExtensions::Functions::Lists
- Compass::SassExtensions::Functions::Math
- Compass::SassExtensions::Functions::Selectors
- Compass::SassExtensions::Functions::Sprites
- Compass::SassExtensions::Functions::Sprites::VariableReader
- Compass::SassExtensions::Functions::Urls
- Compass::SassExtensions::Functions::Urls::FontUrl
- Compass::SassExtensions::Functions::Urls::GeneratedImageUrl
- Compass::SassExtensions::Functions::Urls::ImageUrl
- Compass::SassExtensions::Functions::Urls::StylesheetUrl
- 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::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::Util
- Compass::Version
- Sass
- Sass::Script
- Sass::Script::CrossBrowserFunctionCall
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::HasSimpleCrossBrowserFunctionSupport
- Sass::Script::List
- Sass::Tree
- Sass::Tree::Node
- QuickCache

No matching classes.

# Compass::Configuration::Inheritance::ClassMethods

### Public Instance Methods

chained_method(method) click to toggle source

    # File lib/compass/configuration/inheritance.rb, line 159
    def chained_method(method)
      line = __LINE__ + 1
      class_eval %{
        alias_method :_chained_#{method}, method
        def #{method}(*args, &block)
          _chained_#{method}(*args, &block)
          if inherited_data
            inherited_data.#{method}(*args, &block)
          end
        end
      }, __FILE__, line
    end

inherited_accessor(*attributes) click to toggle source

    # File lib/compass/configuration/inheritance.rb, line 59
    def inherited_accessor(*attributes)
      inherited_reader(*attributes)
      inherited_writer(*attributes)
    end

inherited_array(*attributes) click to toggle source

    # File lib/compass/configuration/inheritance.rb, line 112
    def inherited_array(*attributes)
      inherited_reader(*attributes)
      inherited_writer(*attributes)
      attributes.each do |attr|
        line = __LINE__ + 1
        class_eval %{
          def #{attr}                                          # def sprite_load_paths
            ArrayProxy.new(self, #{attr.inspect})              #   ArrayProxy.new(self, :sprite_load_paths)
          end                                                  # end
          def #{attr}=(value)                                  # def sprite_load_paths=(value)
            @set_attributes ||= {}                             #   @set_attributes ||= {}
            @set_attributes[#{attr.inspect}] = true            #   @set_attributes[:sprite_load_paths] = true
            @#{attr} = Array(value)                            #   @sprite_load_paths = Array(value)
            @added_to_#{attr} = []                             #   @added_to_sprite_load_paths = []
            @removed_from_#{attr} = []                         #   @removed_from_sprite_load_paths = []
          end                                                  # end
          def read_inherited_#{attr}_array                     # def read_inherited_sprite_load_paths_array
            if #{attr}_set?                                    #  if sprite_load_paths_set?
              @#{attr}                                         #    Array(@#{attr})
            else                                               #  else
              value = if inherited_data                        #    value = Array(read(:sprite_load_paths))
                Array(inherited_data.#{attr})
              else
                Array(read(#{attr.inspect}))
              end
              value -= Array(@removed_from_#{attr})            #    value -= Array(@removed_from_sprite_load_paths)
              Array(@added_to_#{attr}) + value                 #    Array(@added_to_sprite_load_paths) + value
            end                                                #  end
          end                                                  # end
          def add_to_#{attr}(v)                                # def add_to_sprite_load_paths(v)
            if #{attr}_set?                                    #   if sprite_load_paths_set?
              raw_#{attr} << v                                 #     raw_sprite_load_paths << v
            else                                               #   else
              (@added_to_#{attr} ||= []) << v                  #     (@added_to_sprite_load_paths ||= []) << v
            end                                                #   end
          end                                                  # end
          def remove_from_#{attr}(v)                           # def remove_from_sprite_load_paths(v)
            if #{attr}_set?                                    #   if sprite_load_paths_set?
              raw_#{attr}.reject!{|e| e == v}                  #     raw_sprite_load_path.reject!{|e| e == v}s
            else                                               #   else
              (@removed_from_#{attr} ||= []) << v              #     (@removed_from_sprite_load_paths ||= []) << v
            end                                                #   end
          end                                                  # end
        }, __FILE__, line
      end
    end

inherited_reader(*attributes) click to toggle source

Defines the default reader to be an inherited_reader that will look at the inherited_data for its value when not set. The inherited reader calls to a raw reader that acts like a normal attribute reader but prefixes the attribute name with "raw_".

    # File lib/compass/configuration/inheritance.rb, line 42
    def inherited_reader(*attributes)
      attributes.each do |attribute|
        line = __LINE__ + 1
        class_eval %{
          def raw_#{attribute}                         # def raw_css_dir
            @#{attribute}                              #   @css_dir
          end                                          # end
          def #{attribute}_without_default             # def css_dir_without_default
            read_without_default(#{attribute.inspect}) #  read_without_default(:css_dir)
          end                                          # end
          def #{attribute}                             # def css_dir
            read(#{attribute.inspect})                 #  read(:css_dir)
          end                                          # end
        }, __FILE__, line
      end
    end

inherited_writer(*attributes) click to toggle source

    # File lib/compass/configuration/inheritance.rb, line 18
    def inherited_writer(*attributes)
      attributes.each do |attribute|
        line = __LINE__ + 1
        class_eval %{
          def #{attribute}=(value)                        # def css_dir=(value)
            @set_attributes ||= {}                        #   @set_attributes ||= {}
            @set_attributes[#{attribute.inspect}] = true  #   @set_attributes[:css_dir] = true
            @#{attribute} = value                         #   @css_dir = value
          end                                             # end

          def unset_#{attribute}!                         # def unset_css_dir!
            unset!(#{attribute.inspect})                  #   unset!(:css_dir)
          end                                             # end

          def #{attribute}_set?                           # def css_dir_set?
            set?(#{attribute.inspect})                    #   set?(:css_dir)
          end                                             # end
        }, __FILE__, line
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.