Sha256: a303dd02cbfe513e14d594968fe90a61042b3490f6d6b82ae54289244cbdfedf
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
# typed: true require 'datadog/tracing/contrib/configuration/resolver' module Datadog module Tracing 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 end
Version data entries
4 entries across 4 versions & 1 rubygems