Freeze configuration defaults & duplicate in deep_merge_hashes if need be.
This commit is contained in:
parent
ad59b6e62a
commit
d84844c223
|
@ -72,7 +72,7 @@ module Jekyll
|
|||
'hard_wrap' => false,
|
||||
'footnote_nr' => 1
|
||||
}
|
||||
}].freeze
|
||||
}.map { |k, v| [k, v.freeze] }].freeze
|
||||
|
||||
class << self
|
||||
# Static: Produce a Configuration ready for use in a Site.
|
||||
|
|
|
@ -54,6 +54,10 @@ module Jekyll
|
|||
target.default_proc = overwrite.default_proc
|
||||
end
|
||||
|
||||
target.each do |key, val|
|
||||
target[key] = val.dup if val.frozen? && duplicable?(val)
|
||||
end
|
||||
|
||||
target
|
||||
end
|
||||
|
||||
|
@ -61,6 +65,15 @@ module Jekyll
|
|||
value.is_a?(Hash) || value.is_a?(Drops::Drop)
|
||||
end
|
||||
|
||||
def duplicable?(obj)
|
||||
case obj
|
||||
when nil, false, true, Symbol, Numeric
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
# Read array from the supplied hash favouring the singular key
|
||||
# and then the plural key, and handling any nil entries.
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue