Use a deterministic order for setting configuration defaults.

This commit is contained in:
Chris Eppstein 2009-04-06 00:35:19 -07:00
parent 6c0a301d91
commit ff14940206

View File

@ -54,12 +54,18 @@ module Compass
def default_all(options)
ATTRIBUTES.each do |a|
self.send("#{a}=", options[a]) unless self.send(a)
set_default_unless_set(a, options[a])
end
end
def set_default_unless_set(attribute, value)
self.send("#{attribute}=", value) unless self.send(attribute)
end
def set_defaults!
default_all(ATTRIBUTES.inject({}){|m, a| m[a] = default_for(a); m})
ATTRIBUTES.each do |a|
set_default_unless_set(a, default_for(a))
end
end
def default_for(attribute)