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,
|
'hard_wrap' => false,
|
||||||
'footnote_nr' => 1
|
'footnote_nr' => 1
|
||||||
}
|
}
|
||||||
}].freeze
|
}.map { |k, v| [k, v.freeze] }].freeze
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
# Static: Produce a Configuration ready for use in a Site.
|
# Static: Produce a Configuration ready for use in a Site.
|
||||||
|
|
|
@ -54,6 +54,10 @@ module Jekyll
|
||||||
target.default_proc = overwrite.default_proc
|
target.default_proc = overwrite.default_proc
|
||||||
end
|
end
|
||||||
|
|
||||||
|
target.each do |key, val|
|
||||||
|
target[key] = val.dup if val.frozen? && duplicable?(val)
|
||||||
|
end
|
||||||
|
|
||||||
target
|
target
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -61,6 +65,15 @@ module Jekyll
|
||||||
value.is_a?(Hash) || value.is_a?(Drops::Drop)
|
value.is_a?(Hash) || value.is_a?(Drops::Drop)
|
||||||
end
|
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
|
# Read array from the supplied hash favouring the singular key
|
||||||
# and then the plural key, and handling any nil entries.
|
# and then the plural key, and handling any nil entries.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue