Sha256: b956b335e5a3f65db53430f875f143b8271adca1af6caa18beb88d2f0dca2d5a

Contents?: true

Size: 523 Bytes

Versions: 5

Compression:

Stored size: 523 Bytes

Contents

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}


#m.set(:a, :b, 42)
#p m.get(:a, :b)


#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
end

Map.update_options_for!(args) do |options|
  options[:time] = Time.now 
end

p args

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
map-4.6.1 a.rb
map-4.6.0 a.rb
map-4.5.1 a.rb
map-4.5.0 a.rb
map-4.4.0 a.rb