Permalink
Browse files

Updates to the mash for ensuring that nil values aren't overwritten

  • Loading branch information...
Daniel Neighman
Daniel Neighman committed Nov 13, 2009
1 parent 39f0208 commit 751855c5a23cc32c92ea716e9b0d640684695fac
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/hashie/mash.rb
View
@@ -78,8 +78,9 @@ def []=(key,value) #:nodoc:
# 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

0 comments on commit 751855c

Please sign in to comment.