Module: Datadog::Tracing::Contrib::Rails::Utils

Defined in:
lib/datadog/tracing/contrib/rails/utils.rb

Overview

common utilities for Rails

Class Method Summary collapse

Class Method Details

.app_nameObject



11
12
13
14
15
16
17
18
19
# File 'lib/datadog/tracing/contrib/rails/utils.rb', line 11

def self.app_name
  if ::Rails::VERSION::MAJOR >= 6
    ::Rails.application.class.module_parent_name.underscore
  elsif ::Rails::VERSION::MAJOR >= 4
    ::Rails.application.class.parent_name.underscore
  else
    ::Rails.application.class.to_s.underscore
  end
end

.railtie_supported?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/datadog/tracing/contrib/rails/utils.rb', line 21

def self.railtie_supported?
  !!(defined?(::Rails::VERSION::MAJOR) && ::Rails::VERSION::MAJOR >= 3 && defined?(::Rails::Railtie))
end