Class/Module Index [+]

Quicksearch

Compass::Configuration::Inheritance::ClassMethods

Public Instance Methods

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_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.