Sha256: 528adaa9b474d2ba570e7fa6843d7a690670928f936fe99b19cab72ef2c39a75

Contents?: true

Size: 351 Bytes

Versions: 4

Compression:

Stored size: 351 Bytes

Contents

module WestfieldSwagger::Utilities
  # taken from http://stackoverflow.com/a/13368706
  def deeply_sort_hash(object)
    return object unless object.is_a?(Hash)
    hash = ActiveSupport::OrderedHash.new
    object.each { |k, v| hash[k] = deeply_sort_hash(v) }
    sorted = hash.sort { |a, b| a[0].to_s <=> b[0].to_s }
    hash.class[sorted]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
westfield_swagger-1.2.6 lib/westfield_swagger/utilities.rb
westfield_swagger-1.2.5 lib/westfield_swagger/utilities.rb
westfield_swagger-1.2.4 lib/westfield_swagger/utilities.rb
westfield_swagger-1.2.3 lib/westfield_swagger/utilities.rb