ordered_hash.rb

Path: lib/ordered_hash.rb
Last Update: Thu May 25 20:16:22 CEST 2006

OrderedHash

Version

 1.2006.05.23 (change of the first number means Big Change)

Description

 Hash which preserves order of added items (like PHP array).

Usage

(see examples directory under the ruby gems root directory)

 require 'rubygems'
 require 'ordered_hash'

 hsh = OrderedHash.new
 hsh['z'] = 1
 hsh['a'] = 2
 hsh['c'] = 3
 p hsh.keys     # ['z','a','c']

Source

simplypowerful.1984.cz/goodlibs/1.2006.05.23

Author

 jan molic (/mig/at_sign/1984/dot/cz/)

Thanks to

 Andrew Johnson for his suggestions and fixes of Hash[], merge, to_a, inspect and shift
 Desmond Dsouza for == fixes

Licence

 You can redistribute it and/or modify it under the same terms of Ruby's license;
 either the dual license version in 2003, or any later version.

[Validate]