Sha256: f6af178046d613dc969a0b18fe74f39afd2d184968e3d4440cd5a100b5cb823d
Contents?: true
Size: 1.02 KB
Versions: 5
Compression:
Stored size: 1.02 KB
Contents
# typed: true require 'ddtrace/contrib/configuration/resolver' module Datadog module Contrib module Configuration # Resolves a value to a configuration key module Resolvers # Matches Strings and Regexps against `object.to_s` objects # and Procs against plain objects. class PatternResolver < Contrib::Configuration::Resolver def resolve(value) return if configurations.empty? # Try to find a matching pattern _, config = configurations.reverse_each.find do |matcher, _| matcher === if matcher.is_a?(Proc) value else value.to_s end end config end protected def parse_matcher(matcher) if matcher.is_a?(Regexp) || matcher.is_a?(Proc) matcher else matcher.to_s end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems