Class: Appsignal::Loaders::HanamiLoader Private

Inherits:
Loader show all
Defined in:
lib/appsignal/loaders/hanami.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: HanamiIntegration

Instance Method Summary collapse

Methods inherited from Loader

register, #register_config_defaults

Instance Method Details

#on_loadObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/appsignal/loaders/hanami.rb', line 8

def on_load
  hanami_app_config = ::Hanami.app.config
  register_config_defaults(
    :root_path => hanami_app_config.root.to_s,
    :env => hanami_app_config.env,
    :ignore_errors => [
      "Hanami::Router::NotAllowedError",
      "Hanami::Router::NotFoundError"
    ]
  )
end

#on_startObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/appsignal/loaders/hanami.rb', line 20

def on_start
  require "appsignal/rack/hanami_middleware"

  hanami_app_config = ::Hanami.app.config
  hanami_app_config.middleware.use(
    ::Rack::Events,
    [Appsignal::Rack::EventHandler.new]
  )
  hanami_app_config.middleware.use(Appsignal::Rack::HanamiMiddleware)

  return unless Gem::Version.new(Hanami::VERSION) < Gem::Version.new("2.2.0")

  ::Hanami::Action.prepend Appsignal::Loaders::HanamiLoader::HanamiIntegration
end