class Datadog::Contrib::Redis::Configuration::Resolver
Converts String URLs and Hashes to a normalized connection settings Hash.
Public Instance Methods
resolve(hash)
click to toggle source
@param [Hash,String] Redis
connection information
Calls superclass method
Datadog::Contrib::Configuration::Resolver#resolve
# File lib/ddtrace/contrib/redis/configuration/resolver.rb, line 13 def resolve(hash) super(parse_matcher(hash)) end
Protected Instance Methods
connection_resolver()
click to toggle source
# File lib/ddtrace/contrib/redis/configuration/resolver.rb, line 39 def connection_resolver @connection_resolver ||= ::Datadog::Contrib::Redis::Vendor::Resolver.new end
normalize(hash)
click to toggle source
# File lib/ddtrace/contrib/redis/configuration/resolver.rb, line 25 def normalize(hash) return { url: hash[:url] } if hash[:scheme] == UNIX_SCHEME # Connexion strings are always converted to host, port, db and scheme # but the host, port, db and scheme will generate the :url only after # establishing a first connexion { host: hash[:host], port: hash[:port], db: hash[:db], scheme: hash[:scheme] } end
parse_matcher(matcher)
click to toggle source
# File lib/ddtrace/contrib/redis/configuration/resolver.rb, line 19 def parse_matcher(matcher) matcher = { url: matcher } if matcher.is_a?(String) normalize(connection_resolver.resolve(matcher)) end