Class: Bullematic::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/bullematic/integrations/rails.rb,
sig/generated/bullematic/integrations/rails.rbs

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.

RBS:

  • app: untyped

  • return: void

Parameters:

  • app (Object)


32
33
34
# File 'lib/bullematic/integrations/rails.rb', line 32

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

RBS:

  • env: Hash[String, untyped]

  • return: untyped

Parameters:

  • env (Hash[String, untyped])

Returns:

  • (Object)


38
39
40
41
42
# File 'lib/bullematic/integrations/rails.rb', line 38

def call(env)
  @app.call(env)
ensure
  capture_notifications(env)
end

#capture_notifications(env) ⇒ void

This method returns an undefined value.

RBS:

  • env: Hash[String, untyped]

  • return: void

Parameters:

  • env (Hash[String, untyped])


48
49
50
51
52
# File 'lib/bullematic/integrations/rails.rb', line 48

def capture_notifications(env)
  if Bullematic.enabled? && EvidenceStore.recording? && defined?(Bullet)
    Bullematic::Notifier.process_notifications(context_id: env.object_id)
  end
end