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
- #raw_database_adapter ⇒ Object
- #version ⇒ Object
Instance Method Details
#application_name ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 23 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
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 37 def database_engine default = :mysql if defined?(ActiveRecord::Base) case raw_database_adapter when "postgres" then :postgres when "postgresql" then :postgres when "postgis" then :postgres when "sqlite3" then :sqlite when "mysql" then :mysql when "mysql2" then :mysql else default end else default end rescue default end |
#env ⇒ Object
32 33 34 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 32 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 21 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 16 def present? defined?(::Rails) && defined?(::Rails::VERSION) && defined?(ActionController) && Rails::VERSION::MAJOR < 3 end |
#raw_database_adapter ⇒ Object
57 58 59 60 61 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 57 def raw_database_adapter ActiveRecord::Base.configurations[env]["adapter"] rescue nil end |
#version ⇒ Object
12 13 14 |
# File 'lib/scout_apm/framework_integrations/rails_2.rb', line 12 def version Rails::VERSION::STRING end |