Sha256: 802ce9c350506d6135ad84a25567882bcbfd3d2950510f3119464ab663f45329
Contents?: true
Size: 1.41 KB
Versions: 22
Compression:
Stored size: 1.41 KB
Contents
require "pact_broker/config/space_delimited_string_list" require "pact_broker/config/space_delimited_integer_list" module PactBroker module Config module RuntimeConfigurationCoercionMethods def value_to_string_array value, property_name if value.is_a?(String) PactBroker::Config::SpaceDelimitedStringList.parse(value) elsif value.is_a?(Array) # parse structured values to possible regexp [*value].flat_map do | val | if val.is_a?(String) PactBroker::Config::SpaceDelimitedStringList.parse(val) else [val] end end elsif value raise ConfigurationError.new("Pact Broker configuration property `#{property_name}` must be a space delimited String or an Array. Got: #{value.inspect}") end end private :value_to_string_array def value_to_integer_array value, property_name if value.is_a?(String) PactBroker::Config::SpaceDelimitedIntegerList.parse(value) elsif value.is_a?(Array) value.collect { |v| v.to_i } elsif value.is_a?(Integer) [value] elsif value raise ConfigurationError.new("Pact Broker configuration property `#{property_name}` must be a space delimited String or an Array of Integers. Got: #{value.inspect}") end end private :value_to_integer_array end end end
Version data entries
22 entries across 22 versions & 1 rubygems