lib/rex/service_manager.rb in librex-0.0.29 vs lib/rex/service_manager.rb in librex-0.0.30
- old
+ new
@@ -125,10 +125,22 @@
# Return false if the service isn't there
return false
end
+ #
+ # Overrides the builtin 'each' operator to avoid the following exception on Ruby 1.9.2+
+ # "can't add a new key into hash during iteration"
+ #
+ def each(&block)
+ list = []
+ self.keys.sort.each do |sidx|
+ list << [sidx, self[sidx]]
+ end
+ list.each(&block)
+ end
+
protected
#
# Returns the alias for a given service instance.
#
@@ -136,6 +148,6 @@
"__#{klass.name}#{args}"
end
end
-end
\ No newline at end of file
+end