Class: ScoutApm::FrameworkIntegrations::Rails3Or4
- Inherits:
-
Object
- Object
- ScoutApm::FrameworkIntegrations::Rails3Or4
- Defined in:
- lib/scout_apm/framework_integrations/rails_3_or_4.rb
Instance Method Summary collapse
- #application_name ⇒ Object
- #database_engine ⇒ Object
- #env ⇒ Object
- #get_database_adapter ⇒ 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_3_or_4.rb', line 22 def application_name if defined?(::Rails) ::Rails.application.class.to_s. sub(/::Application$/, '') end rescue nil end |
#database_engine ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/scout_apm/framework_integrations/rails_3_or_4.rb', line 35 def database_engine return @database_engine if @database_engine default = :mysql @database_engine = if defined?(ActiveRecord::Base) adapter = get_database_adapter # can be nil case 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 # TODO: Figure out how to detect outside of Rails context. (sequel, ROM, etc) default end end |
#env ⇒ Object
31 32 33 |
# File 'lib/scout_apm/framework_integrations/rails_3_or_4.rb', line 31 def env ::Rails.env end |
#get_database_adapter ⇒ Object
56 57 58 59 60 |
# File 'lib/scout_apm/framework_integrations/rails_3_or_4.rb', line 56 def get_database_adapter ActiveRecord::Base.configurations[env]["adapter"] rescue # this would throw an exception if ActiveRecord::Base is defined but no configuration exists. nil end |
#human_name ⇒ Object
8 9 10 |
# File 'lib/scout_apm/framework_integrations/rails_3_or_4.rb', line 8 def human_name "Rails" end |
#name ⇒ Object
4 5 6 |
# File 'lib/scout_apm/framework_integrations/rails_3_or_4.rb', line 4 def name :rails3_or_4 end |
#present? ⇒ Boolean
16 17 18 19 20 |
# File 'lib/scout_apm/framework_integrations/rails_3_or_4.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_3_or_4.rb', line 12 def version Rails::VERSION::STRING end |