From bda7cfd264f95973528a061af0740adf8db4e6a1 Mon Sep 17 00:00:00 2001 From: Jim Menard Date: Mon, 12 Jan 2009 16:28:29 -0500 Subject: [PATCH] OrderedHash is not necessary with Ruby 1.9, so we stub out the innards of the class but keep the class for code compatability. --- lib/mongo/util/ordered_hash.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/mongo/util/ordered_hash.rb b/lib/mongo/util/ordered_hash.rb index 0448eb6..2e05fc9 100644 --- a/lib/mongo/util/ordered_hash.rb +++ b/lib/mongo/util/ordered_hash.rb @@ -15,8 +15,14 @@ # ++ # A hash in which the order of keys are preserved. +# +# Under Ruby 1.9 and greater, this class has no added methods because Ruby's +# Hash already keeps its keys ordered by order of insertion. class OrderedHash < Hash + # We only need the body of this class if the RUBY_VERSION is before 1.9 + if RUBY_VERSION < '1.9' + attr_accessor :ordered_keys def keys @@ -57,4 +63,6 @@ class OrderedHash < Hash str << '}' end + end # Ruby before 1.9 + end