Frozen works strangely on nils
This commit is contained in:
parent
ff11be93a0
commit
767db6ff26
|
@ -23,7 +23,7 @@ if ENV['TEST'] || ENV['CONTRACTS'] == 'true'
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid?(val)
|
def valid?(val)
|
||||||
val.frozen? && Contract.valid?(val, @contract)
|
(val.frozen? || val.nil?) && Contract.valid?(val, @contract)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ module Middleman
|
||||||
self.class.new(data)
|
self.class.new(data)
|
||||||
elsif data.is_a? Array
|
elsif data.is_a? Array
|
||||||
data.map(&method(:recursively_enhance)).freeze
|
data.map(&method(:recursively_enhance)).freeze
|
||||||
elsif data.frozen?
|
elsif data.frozen? || data.nil?
|
||||||
data
|
data
|
||||||
else
|
else
|
||||||
data.dup.freeze
|
data.dup.freeze
|
||||||
|
|
Loading…
Reference in a new issue