Sha256: 38a76a574d1e139a18ce020739d42486c798058c51c674d7effec4ac7eb235cb

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

module NewRelic
  class Control
    module ClassMethods
      # Access the Control singleton, lazy initialized
      def instance
        @instance ||= new_instance
      end

      # Create the concrete class for environment specific behavior:
      def new_instance
        @local_env = NewRelic::LocalEnvironment.new
        if @local_env.framework == :test
          config = File.expand_path("../../../../test/config/newrelic.yml", __FILE__)
          require "config/test_control"
          NewRelic::Control::Frameworks::Test.new @local_env, config
        else
          begin
            require "new_relic/control/frameworks/#{@local_env.framework}.rb"
          rescue LoadError
          end
          klass = NewRelic::Control::Frameworks.const_get(@local_env.framework.to_s.capitalize)
          klass.new @local_env
        end
      end

      # The root directory for the plugin or gem
      def newrelic_root
        File.expand_path("../../../..", __FILE__)
      end
    end
    extend ClassMethods
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-3.0.1 lib/new_relic/control/class_methods.rb
newrelic_rpm-3.0.0 lib/new_relic/control/class_methods.rb
newrelic_rpm-3.0.0.beta2 lib/new_relic/control/class_methods.rb
newrelic_rpm-3.0.0.beta1 lib/new_relic/control/class_methods.rb