Sha256: 1584f3a860a2825d9db413f0ee76a5e7a3f3cde284740b02946fdae184a223ac
Contents?: true
Size: 422 Bytes
Versions: 6
Compression:
Stored size: 422 Bytes
Contents
class Hash def ordered_array to_a.sort { |(key1, value1), (key2, value2)| key1.hash <=> key2.hash } end undef :keys def keys ordered_array.collect(&:first) end undef :values def values ordered_array.collect { |_, v| v } end undef :each def each(&block) ordered_array.each(&block) end undef :shift def shift returning to_a.first do |k, v| delete(k) end end end
Version data entries
6 entries across 6 versions & 1 rubygems