lib/nugrant/bag.rb in nugrant-2.0.0.dev1 vs lib/nugrant/bag.rb in nugrant-2.0.0.dev2

- old
+ new

@@ -13,11 +13,11 @@ def [](key) return __fetch(key) end def method_missing(method, *args, &block) - return __fetch(method.to_s) + return __fetch(method) end def has?(key) return @__elements.has_key?(key) end @@ -62,11 +62,11 @@ def __to_hash() return {} if empty?() hash = {} each do |key, value| - hash[key] = value.kind_of?(Bag) ? value.__to_hash() : value + hash[key.to_sym()] = value.kind_of?(Bag) ? value.__to_hash() : value end return hash end @@ -74,15 +74,15 @@ @__elements = {} return if hash == nil or not hash.kind_of?(Hash) hash.each do |key, value| if not value.kind_of?(Hash) - @__elements[key] = value + @__elements[key.to_sym()] = value next end # It is a hash, transform it into a bag - @__elements[key] = Bag.new(value) + @__elements[key.to_sym()] = Bag.new(value) end end def __fetch(key) if not has?(key)