U:RDoc::AnyMethod[iI"new:ETI"Hash::new;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"IReturns a new, empty hash. If this hash is subsequently accessed by ;TI"Ga key that doesn't correspond to a hash entry, the value returned ;TI"Jdepends on the style of new used to create the hash. In ;TI"=the first form, the access returns nil. If ;TI"Bobj is specified, this single object will be used for ;TI"Fall default values. If a block is specified, it will be ;TI"Dcalled with the hash object and the key, and should return the ;TI"Hdefault value. It is the block's responsibility to store the value ;TI"in the hash if required.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"h = Hash.new("Go Fish") ;TI"h["a"] = 100 ;TI"h["b"] = 200 ;TI"h["a"] #=> 100 ;TI"$h["c"] #=> "Go Fish" ;TI"6# The following alters the single default object ;TI"$h["c"].upcase! #=> "GO FISH" ;TI"$h["d"] #=> "GO FISH" ;TI"%h.keys #=> ["a", "b"] ;TI" ;TI"9# While this creates a new default object each time ;TI"@h = Hash.new { |hash, key| hash[key] = "Go Fish: #{key}" } ;TI"'h["c"] #=> "Go Fish: c" ;TI"'h["c"].upcase! #=> "GO FISH: C" ;TI"'h["d"] #=> "Go Fish: d" ;TI"$h.keys #=> ["c", "d"];T: @format0: @fileI" hash.c;T:0@omit_headings_from_table_of_contents_below0I"ŠHash.new -> new_hash Hash.new(obj) -> new_hash Hash.new {|hash, key| block } -> new_hash ;T0[I" (*args);T@)FI" Hash;TcRDoc::NormalClass00