From: Adam Jahn Date: Fri, 8 Jul 2016 19:32:42 +0000 (-0400) Subject: Ruby 1.8.7 doesn't preserve hash insertion order X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=0717f95455d882875107086544477fe9e8253fa1;p=puppet-samba.git Ruby 1.8.7 doesn't preserve hash insertion order --- diff --git a/spec/support/augeas.rb b/spec/support/augeas.rb index 4912e1a..7548684 100644 --- a/spec/support/augeas.rb +++ b/spec/support/augeas.rb @@ -19,9 +19,10 @@ module Augeas [target, name, Change].hash end - def eql?(other) + def ==(other) other.is_a?(self.class) && [other.target, other.name] == [target, name] end + alias_method :eql?, :== private @@ -37,11 +38,12 @@ module Augeas class ChangeSet def initialize - @set = {} + @set = [] end def <<(change) - @set[change] = change + index = @set.index(change) || @set.length + @set[index] = change end def to_a @@ -49,7 +51,7 @@ module Augeas end def changes - @set.values.map(&:to_s) + @set.map(&:to_s) end end