module Compass::Configuration
Constants
- ARRAY_ATTRIBUTES
- ARRAY_ATTRIBUTE_OPTIONS
- ATTRIBUTES
- RUNTIME_READONLY_ATTRIBUTES
Public Class Methods
add_configuration_property(name, comment = nil, &default)
click to toggle source
Registers a new configuration property. Extensions can use this to add new configuration options to compass.
@param [Symbol] name The name of the property. @param [String] comment A comment for the property. @param [Proc] default A method to calculate the default value for the property.
The proc is executed in the context of the project's configuration data.
# File lib/compass/configuration.rb, line 21 def add_configuration_property(name, comment = nil, &default) ATTRIBUTES << name if comment.is_a?(String) unless comment[0..0] == "#" comment = "# #{comment}" end unless comment[-1..-1] == "\n" comment = comment + "\n" end Data.class_eval <<-COMMENT def comment_for_#{name} #{comment.inspect} end COMMENT end Data.send(:define_method, :"default_#{name}", &default) if default Data.inherited_accessor(name) if name.to_s =~ /dir|path/ Data.strip_trailing_separator(name) end end
attributes_for_directory(dir_name, http_dir_name = dir_name)
click to toggle source
# File lib/compass/configuration.rb, line 5 def attributes_for_directory(dir_name, http_dir_name = dir_name) [ "#{dir_name}_dir", "#{dir_name}_path", ("http_#{http_dir_name}_dir" if http_dir_name), ("http_#{http_dir_name}_path" if http_dir_name) ].compact.map{|a| a.to_sym} end
remove_configuration_property(name)
click to toggle source
For testing purposes
# File lib/compass/configuration.rb, line 44 def remove_configuration_property(name) ATTRIBUTES.delete(name) end