a.rb in map-4.6.1 vs a.rb in map-4.7.0

- old
+ new

@@ -1,44 +1,24 @@ require 'map' -#m = Map.new -#m.default = [] - -class Errors < ::Map - def [](key) - self[key] = Array.new unless has_key?(key) - super - end -end -e = Errors.new -p e[:k] -p e -e.set(:a, :b, 42) -p e.get(:a, :b) -p e -#m = Map.new{|m,k| m[k] ||= Array.new} +require 'rubygems' +require 'mongoid' +class Map + include Mongoid::Fields::Serializable -#m.set(:a, :b, 42) -#p m.get(:a, :b) + def default(*args) + @default + end + def deserialize(object) + Map.for(object.to_hash) + end -#m[:a].push(:b) -#p m[:a] -#p m -#p m - - -__END__ -args = [:a, :b, {:k => :v}] - -Map.update_options_for!(args) do |options| - options[:foo] = :bar + def serialize(object) + object.to_hash + end end -Map.update_options_for!(args) do |options| - options[:time] = Time.now -end - -p args - +m = Map.new +m[:key]