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
|
||||
|
||||
def valid?(val)
|
||||
val.frozen? && Contract.valid?(val, @contract)
|
||||
(val.frozen? || val.nil?) && Contract.valid?(val, @contract)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ module Middleman
|
|||
self.class.new(data)
|
||||
elsif data.is_a? Array
|
||||
data.map(&method(:recursively_enhance)).freeze
|
||||
elsif data.frozen?
|
||||
elsif data.frozen? || data.nil?
|
||||
data
|
||||
else
|
||||
data.dup.freeze
|
||||
|
|
Loading…
Reference in a new issue