Module: PactBroker::Config::RuntimeConfigurationCoercionMethods

Included in:
RuntimeConfiguration
Defined in:
lib/pact_broker/config/runtime_configuration_coercion_methods.rb

Instance Method Summary collapse

Instance Method Details

#all_keys_are_number_strings?(hash) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/pact_broker/config/runtime_configuration_coercion_methods.rb', line 8

def all_keys_are_number_strings?(hash)
  hash.keys.all? { | k | k.to_s.to_i.to_s == k } # is an integer as a string
end

#convert_hash_with_number_string_keys_to_array(hash) ⇒ Object



12
13
14
15
16
# File 'lib/pact_broker/config/runtime_configuration_coercion_methods.rb', line 12

def convert_hash_with_number_string_keys_to_array(hash)
  hash.keys.collect{ |k| [k, k.to_i]}.sort_by(&:last).collect(&:first).collect do | key |
    hash[key]
  end
end