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 52 def self.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 " def comment_for_#{name} #{comment.inspect} end " end Data.send(:define_method, :"default_#{name}", &default) if default Data.inherited_accessor(name) if name.to_s =~ %rdir|path/ strip_trailing_separator(name) end end
# File lib/compass/configuration.rb, line 4 def self.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
For testing purposes
# File lib/compass/configuration.rb, line 75 def self.remove_configuration_property(name) ATTRIBUTES.delete(name) end