JezK
Edit File: cdesc-Hashery.ri
U:RDoc::NormalModule[iI"Hashery:EF@0o:RDoc::Markup::Document:@parts[o;;[ : @fileI"lib/hashery.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ ; I"lib/hashery/association.rb;T; 0o;;[ ; I" lib/hashery/casting_hash.rb;T; 0o;;[ ; I"lib/hashery/crud_hash.rb;T; 0o;;[ ; I"lib/hashery/dictionary.rb;T; 0o;;[ ; I"lib/hashery/fuzzy_hash.rb;T; 0o;;[ ; I"lib/hashery/ini_hash.rb;T; 0o;;[ ; I"lib/hashery/key_hash.rb;T; 0o;;[ ; I"lib/hashery/linked_list.rb;T; 0o;;[ ; I"lib/hashery/lru_hash.rb;T; 0o;;[ ; I" lib/hashery/open_cascade.rb;T; 0o;;[ ; I"lib/hashery/open_hash.rb;T; 0o;;[ ; I" lib/hashery/ordered_hash.rb;T; 0o;;[ ; I"lib/hashery/path_hash.rb;T; 0o;;[ ; I"!lib/hashery/property_hash.rb;T; 0o;;[ ; I"lib/hashery/query_hash.rb;T; 0o;;[ ; I"lib/hashery/stash.rb;T; 0o;;[ ; I"lib/hashery/static_hash.rb;T; 0; 0; 0[ [U:RDoc::Constant[i I"VERSION;FI"Hashery::VERSION;F00o;;[ ; @; 0@@cRDoc::NormalModule0U;[i I" Stash;FI"Hashery::Stash;F0I"Hashery::KeyHash;Fo;;[o:RDoc::Markup::Paragraph;[I"AThe KeyHash class is a Hash class which accepts a block for ;TI"normalizing keys.;To:RDoc::Markup::BlankLine o;;[I"AThe KeyHash class is essentially the same as a normal Hash. ;TI"?But notice the significant distinction of indifferent key ;TI"access.;T@To:RDoc::Markup::Verbatim;[ I"s = KeyHash.new ;TI"s[:x] = 1 ;TI"s[:x] #=> 1 ;TI"s['x'] #=> 1 ;T:@format0o;;[I"BWe can see that internally the key has indeed been converted ;TI"to a String.;T@To;;[I"s.to_h #=> {'x'=>1 } ;T;0o;;[I"KBy default all keys are converted to strings. This has two advantages ;TI"Lover a regular Hash is many usecases. First it means hash entries have ;TI"Jindifferent access. <tt>1</tt>, <tt>"1"</tt> and <tt>:1</tt> are all ;TI"Oequivalent --any object that defines <tt>#to_s</tt> can be used as a key. ;TI"KSecondly, since strings are garbage collected so will default KeyHash ;TI"objects. ;T@To;;[I"OBut keys can be normalized by any function. Theses functions can be quite ;TI"unique.;T@To;;[ I"&h = KeyHash.new(0){ |k| k.to_i } ;TI"h[1.34] += 1 ;TI"h[1.20] += 1 ;TI"h[1.00] += 1 ;TI"h #=> { 1 => 3 };T;0; @!; 0@<@@H0[ [[I" class;T[[:public[ [:protected[ [:private[ [I" instance;T[[;[ [;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0; 0[@@@@@@@@!@$@'@*@-@0@3@6@9@<@?@?cRDoc::TopLevel