Frozen works strangely on nils

This commit is contained in:
Thomas Reynolds 2014-07-23 22:09:46 -07:00
parent ff11be93a0
commit 767db6ff26
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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