Sha256: b5b33cac83ba1745744b890b14f87b88ba76efb8768c7bba3ec52d6f2ce4c127
Contents?: true
Size: 1009 Bytes
Versions: 14
Compression:
Stored size: 1009 Bytes
Contents
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details. module NewRelic module Agent class DatabaseAdapter VERSIONS = { '6.1.0' => proc { ActiveRecord::Base.connection_db_config.configuration_hash[:adapter] }, '4.0.0' => proc { ActiveRecord::Base.connection_config[:adapter] }, '3.0.0' => proc { |env| ActiveRecord::Base.configurations[env]['adapter'] } } def self.value return unless defined? ActiveRecord::Base new(::NewRelic::Control.instance.env, ActiveRecord::VERSION::STRING).value end attr_reader :env, :version def initialize(env, version) @env = env @version = Gem::Version.new(version) end def value match = VERSIONS.keys.find { |key| version >= Gem::Version.new(key) } return unless match VERSIONS[match].call(env) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems