Class: ScoutApm::FrameworkIntegrations::Rails2
- Inherits:
-
Object
- Object
- ScoutApm::FrameworkIntegrations::Rails2
- Defined in:
- lib/scout_apm/framework_integrations/rails_2.rb
Instance Method Summary collapse
- #application_name ⇒ Object
-
#database_engine ⇒ Object
Attempts to determine the database engine being used.
- #env ⇒ Object
- #human_name ⇒ Object
- #name ⇒ Object
- #present? ⇒ Boolean
- #version ⇒ Object
Instance Method Details
#application_name ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 22 def application_name if defined?(::Rails) ::Rails.application.class.to_s. sub(/::Application$/, '') end rescue nil end |
#database_engine ⇒ Object
Attempts to determine the database engine being used
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 36 def database_engine default = :mysql if defined?(ActiveRecord::Base) config = ActiveRecord::Base.configurations[env] if config && config["adapter"] case config["adapter"].to_s when "postgres" then :postgres when "postgresql" then :postgres when "postgis" then :postgres when "sqlite3" then :sqlite when "mysql" then :mysql else default end else default end else default end rescue default end |
#env ⇒ Object
31 32 33 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 31 def env RAILS_ENV.dup end |
#human_name ⇒ Object
8 9 10 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 8 def human_name "Rails" end |
#name ⇒ Object
4 5 6 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 4 def name :rails end |
#present? ⇒ Boolean
16 17 18 19 20 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 16 def present? defined?(::Rails) && defined?(ActionController) && Rails::VERSION::MAJOR < 3 end |
#version ⇒ Object
12 13 14 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 12 def version Rails::VERSION::STRING end |