module PactBroker::Pacts::OrderHashKeys
Public Class Methods
call(thing)
click to toggle source
# File lib/pact_broker/pacts/order_hash_keys.rb, line 6 def self.call thing case thing when Hash then order_hash(thing) when Array then order_child_array(thing) else thing end end
order_child_array(array)
click to toggle source
# File lib/pact_broker/pacts/order_hash_keys.rb, line 14 def self.order_child_array array array.collect{ |thing| call(thing) } end
order_hash(hash)
click to toggle source
# File lib/pact_broker/pacts/order_hash_keys.rb, line 18 def self.order_hash hash hash.keys.sort.each_with_object({}) do | key, new_hash | new_hash[key] = call(hash[key]) end end
Public Instance Methods
order_hash_keys(thing)
click to toggle source
# File lib/pact_broker/pacts/order_hash_keys.rb, line 24 def order_hash_keys(thing) OrderHashKeys.call(thing) end