Class: Appsignal::Hooks::SequelHook

Inherits:
Hook
  • Object
show all
Defined in:
lib/appsignal/hooks/sequel.rb

Instance Method Summary collapse

Methods inherited from Hook

#installed?, register, #try_to_install

Instance Method Details

#dependencies_present?Boolean

Returns:

  • (Boolean)

30
31
32
33
34
# File 'lib/appsignal/hooks/sequel.rb', line 30

def dependencies_present?
  defined?(::Sequel::Database) &&
    Appsignal.config &&
    Appsignal.config[:instrument_sequel]
end

#installObject


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/appsignal/hooks/sequel.rb', line 36

def install
  # Register the extension...
  if ::Sequel::MAJOR >= 4 && ::Sequel::MINOR >= 35
    ::Sequel::Database.register_extension(
      :appsignal_integration,
      Appsignal::Hooks::SequelLogConnectionExtension
    )
  else
    ::Sequel::Database.register_extension(
      :appsignal_integration,
      Appsignal::Hooks::SequelLogExtension
    )
  end

  # ... and automatically add it to future instances.
  ::Sequel::Database.extension(:appsignal_integration)
end