lib/darkext/hash.rb in darkhelmet-darkext-0.11.0 vs lib/darkext/hash.rb in darkhelmet-darkext-0.11.1

- old
+ new

@@ -24,18 +24,15 @@ # Author: Stefan Rusterholz merger = proc { |key,v1,v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 } self.merge!(second, &merger) end - def nested_hash(array) - node = self - array.each do |i| - node[i]=Hash.new if node[i].nil? - node = node[i] + def method_missing(m,*a) + if m.to_s =~ /=$/ + self[$`] = a[0] + elsif a.empty? + self[m] + else + raise NoMethodError, "#{ m}" end - self - end - - def merge_nested_hash!(nested_hash) - deep_merge!(nested_hash) end end