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:
parent
c6bd4fc100
commit
bda7cfd264
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue