Class: ScoutApm::ServerIntegrations::Rainbows
- Inherits:
-
Object
- Object
- ScoutApm::ServerIntegrations::Rainbows
- Defined in:
- lib/scout_apm/server_integrations/rainbows.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #forking? ⇒ Boolean
- #found? ⇒ Boolean
-
#initialize(logger) ⇒ Rainbows
constructor
A new instance of Rainbows.
- #install ⇒ Object
- #name ⇒ Object
- #present? ⇒ Boolean
Constructor Details
#initialize(logger) ⇒ Rainbows
Returns a new instance of Rainbows.
6 7 8 |
# File 'lib/scout_apm/server_integrations/rainbows.rb', line 6 def initialize(logger) @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/scout_apm/server_integrations/rainbows.rb', line 4 def logger @logger end |
Instance Method Details
#forking? ⇒ Boolean
14 |
# File 'lib/scout_apm/server_integrations/rainbows.rb', line 14 def forking?; true; end |
#found? ⇒ Boolean
35 36 37 |
# File 'lib/scout_apm/server_integrations/rainbows.rb', line 35 def found? true end |
#install ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/scout_apm/server_integrations/rainbows.rb', line 23 def install logger.info "Installing Rainbows worker loop." Rainbows::HttpServer.class_eval do old = instance_method(:worker_loop) define_method(:worker_loop) do |worker| ScoutApm::Agent.instance.start_background_worker old.bind(self).call(worker) end end end |
#name ⇒ Object
10 11 12 |
# File 'lib/scout_apm/server_integrations/rainbows.rb', line 10 def name :rainbows end |
#present? ⇒ Boolean
16 17 18 19 20 21 |
# File 'lib/scout_apm/server_integrations/rainbows.rb', line 16 def present? if defined?(::Rainbows) && defined?(::Rainbows::HttpServer) ObjectSpace.each_object(::Rainbows::HttpServer) { |x| return true } false end end |