lib/map.rb in map-2.0.0 vs lib/map.rb in map-2.1.0

- old
+ new

@@ -1,7 +1,7 @@ class Map < Hash - Version = '2.0.0' unless defined?(Version) + Version = '2.1.0' unless defined?(Version) Load = Kernel.method(:load) unless defined?(Load) class << Map def version Map::Version @@ -500,11 +500,12 @@ def to_options!; self end def to_options; dup end def with_indifferent_access!; self end def with_indifferent_access; dup end -# a sane method missing that only supports reading previously set values +# a sane method missing that only supports writing values or reading +# *previously set* values # def method_missing(method, *args, &block) method = method.to_s case method when /=$/ @@ -514,9 +515,14 @@ else key = method super unless has_key?(key) self[key] end + end + + def id + raise NoMethodError unless has_key?(:id) + self[:id] end # support for compound key indexing and depth first iteration # def get(*keys)