photomix/vendor/plugins/authlogic/test/libs/ordered_hash.rb
2011-04-11 18:07:31 +08:00

9 lines
170 B
Ruby

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