Sha256: 1e74dd30382c75e959dd95cb46fb265c09b81c965c48fc8add2b7828e5df7017
Contents?: true
Size: 764 Bytes
Versions: 2
Compression:
Stored size: 764 Bytes
Contents
module Configurations module Validators class Ambiguity # @param [Hash] the hash to test for ambiguity # @raise [Configurations::ConfigurationError] raises this error if # a property is defined ambiguously # def validate!(h) symbols, others = h.keys.partition { |k| k.is_a?(::Symbol) } ambiguous = symbols.map(&:to_s) & others unless ambiguous.empty? ::Kernel.fail( ::Configurations::ConfigurationError, "Can not resolve configuration values for #{ambiguous.join(', ')} " \ "defined as both Symbol and #{others.first.class.name} keys. " \ 'Please resolve the ambiguity.' ) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
configurations-2.2.2 | lib/configurations/validators/ambiguity.rb |
configurations-2.2.1 | lib/configurations/validators/ambiguity.rb |