diff options
author | Daniel Neighman <has.sox@gmail.com> | 2009-11-13 23:26:04 +1100 |
---|---|---|
committer | Daniel Neighman <has.sox@gmail.com> | 2009-11-13 23:26:04 +1100 |
commit | 751855c5a23cc32c92ea716e9b0d640684695fac (patch) | |
tree | 524cba953ea46e527ba7266cab75e3a9898b104d | |
parent | 39f02086229ab9d024d103840e971381aa57c8e0 (diff) | |
download | hashie-751855c5a23cc32c92ea716e9b0d640684695fac.tar.gz |
Updates to the mash for ensuring that nil values aren't overwritten
-rw-r--r-- | lib/hashie/mash.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/hashie/mash.rb b/lib/hashie/mash.rb index d185a48..65222b1 100644 --- a/lib/hashie/mash.rb +++ b/lib/hashie/mash.rb @@ -78,8 +78,9 @@ module Hashie # This is the bang method reader, it will return a new Mash # if there isn't a value already assigned to the key requested. def initializing_reader(key) - self[key] ||= Hashie::Mash.new - self[key] + ck = convert_key(key) + regular_writer(ck, Hashie::Mash.new) unless key?(ck) + regular_reader(ck) end alias_method :regular_dup, :dup |