Sha256: c6d60bf55d0a41f57ebef7361c97c6bdc275c784eedbdc976b939f9d95e51d9e

Contents?: true

Size: 1.46 KB

Versions: 8

Compression:

Stored size: 1.46 KB

Contents

require 'ddtrace/contrib/integration'
require 'ddtrace/contrib/action_view/configuration/settings'
require 'ddtrace/contrib/action_view/patcher'
require 'ddtrace/contrib/rails/utils'

module Datadog
  module Contrib
    module ActionView
      # Describes the ActionView integration
      class Integration
        include Contrib::Integration

        MINIMUM_VERSION = Gem::Version.new('3.0')

        register_as :action_view, auto_patch: false

        def self.version
          # ActionView is its own gem in Rails 4.1+
          if Gem.loaded_specs['actionview']
            Gem.loaded_specs['actionview'].version
          # ActionView is embedded in ActionPack in versions < 4.1
          elsif Gem.loaded_specs['actionpack']
            action_pack_version = Gem.loaded_specs['actionpack'].version
            action_pack_version unless action_pack_version >= Gem::Version.new('4.1')
          end
        end

        def self.loaded?
          !defined?(::ActionView).nil?
        end

        def self.compatible?
          super && version >= MINIMUM_VERSION
        end

        # enabled by rails integration so should only auto instrument
        # if detected that it is being used without rails
        def auto_instrument?
          !Datadog::Contrib::Rails::Utils.railtie_supported?
        end

        def default_configuration
          Configuration::Settings.new
        end

        def patcher
          ActionView::Patcher
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ddtrace-0.51.1 lib/ddtrace/contrib/action_view/integration.rb
ddtrace-0.51.0 lib/ddtrace/contrib/action_view/integration.rb
ddtrace-0.50.0 lib/ddtrace/contrib/action_view/integration.rb
ddtrace-0.49.0 lib/ddtrace/contrib/action_view/integration.rb
ddtrace-0.48.0 lib/ddtrace/contrib/action_view/integration.rb
ddtrace-0.47.0 lib/ddtrace/contrib/action_view/integration.rb
ddtrace-0.46.0 lib/ddtrace/contrib/action_view/integration.rb
ddtrace-0.45.0 lib/ddtrace/contrib/action_view/integration.rb