photomix/vendor/plugins/authlogic/test/libs/ordered_hash.rb

9 lines
170 B
Ruby
Raw Normal View History

2011-04-11 12:07:31 +02:00
class Hash
def each(&block)
sorted_keys = keys.sort { |a, b| a.to_s <=> b.to_s }
sorted_keys.each do |key|
yield key, self[key]
end
self
end
end