OrderedHash is not necessary with Ruby 1.9, so we stub out the innards of the class but keep the class for code compatability.

This commit is contained in:
Jim Menard 2009-01-12 16:28:29 -05:00
parent c6bd4fc100
commit bda7cfd264
1 changed files with 8 additions and 0 deletions

View File

@ -15,8 +15,14 @@
# ++ # ++
# A hash in which the order of keys are preserved. # 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 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 attr_accessor :ordered_keys
def keys def keys
@ -57,4 +63,6 @@ class OrderedHash < Hash
str << '}' str << '}'
end end
end # Ruby before 1.9
end end