Module: Bugstack::Integrations::Generic

Defined in:
lib/bugstack/integrations/generic.rb

Overview

Generic Ruby integration that hooks into at_exit to capture unhandled exceptions.

Usage:

require "bugstack"
require "bugstack/integrations/generic"

Bugstack.init(api_key: "bs_live_...")
Bugstack::Integrations::Generic.install!

Class Method Summary collapse

Class Method Details

.install!Object

Install global exception hooks.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bugstack/integrations/generic.rb', line 18

def self.install!
  return if @installed

  @installed = true

  at_exit do
    if $! && !$!.is_a?(SystemExit)
      Bugstack.capture_exception($!)
    end
  end
end

.installed?Boolean

Check if hooks are installed.

Returns:

  • (Boolean)


31
32
33
# File 'lib/bugstack/integrations/generic.rb', line 31

def self.installed?
  @installed
end

.reset!Object

Reset for testing.



36
37
38
# File 'lib/bugstack/integrations/generic.rb', line 36

def self.reset!
  @installed = false
end