Sha256: 6c554b55976733ea1cb078bd935ade5882c5073e3b85917383c524823e69052e
Contents?: true
Size: 425 Bytes
Versions: 27
Compression:
Stored size: 425 Bytes
Contents
class Hash def sort_array! keys.each do |key| value = self[key] self[key] = sort_array0(value) end self end private def sort_array0(value) case value when Hash new_value = {} value.each do |k, v| new_value[k] = sort_array0(v) end new_value when Array value.map {|v| sort_array0(v) }.sort_by(&:to_s) else value end end end
Version data entries
27 entries across 27 versions & 1 rubygems