Sha256: f544679c9208843a789dbfe0d80c036b44379be3e4b80c33c960c870d361d35d
Contents?: true
Size: 618 Bytes
Versions: 67
Compression:
Stored size: 618 Bytes
Contents
require 'pact_broker/json' module PactBroker module Pacts module OrderHashKeys def self.call thing case thing when Hash then order_hash(thing) when Array then order_child_array(thing) else thing end end def self.order_child_array array array.collect{ |thing| call(thing) } end def self.order_hash hash hash.keys.sort.each_with_object({}) do | key, new_hash | new_hash[key] = call(hash[key]) end end def order_hash_keys(thing) OrderHashKeys.call(thing) end end end end
Version data entries
67 entries across 67 versions & 1 rubygems