]> gitweb.fluxo.info Git - puppet-samba.git/commitdiff
Ruby 1.8.7 doesn't preserve hash insertion order
authorAdam Jahn <ajjahn@gmail.com>
Fri, 8 Jul 2016 19:32:42 +0000 (15:32 -0400)
committerAdam Jahn <ajjahn@gmail.com>
Fri, 8 Jul 2016 19:32:42 +0000 (15:32 -0400)
spec/support/augeas.rb

index 4912e1a22e8b814ada924a9d54e7e9ad14c6b164..75486844d75ade8b8b0736556eea189d4cb0c674 100644 (file)
@@ -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