Class: Appsignal::Hooks::Hook Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/hooks.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.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHook

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.

Returns a new instance of Hook.



27
28
29
# File 'lib/appsignal/hooks.rb', line 27

def initialize
  @installed = false
end

Class Method Details

.register(name, hook = self) ⇒ Object

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.



23
24
25
# File 'lib/appsignal/hooks.rb', line 23

def self.register(name, hook = self)
  Appsignal::Hooks.register(name, hook.new)
end

Instance Method Details

#dependencies_present?Boolean

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.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/appsignal/hooks.rb', line 50

def dependencies_present?
  raise NotImplementedError
end

#installObject

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.

Raises:

  • (NotImplementedError)


54
55
56
# File 'lib/appsignal/hooks.rb', line 54

def install
  raise NotImplementedError
end

#installed?Boolean

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.

Returns:

  • (Boolean)


46
47
48
# File 'lib/appsignal/hooks.rb', line 46

def installed?
  @installed
end

#try_to_install(name) ⇒ Object

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.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/appsignal/hooks.rb', line 31

def try_to_install(name)
  return unless dependencies_present?
  return if installed?

  Appsignal.logger.debug("Installing #{name} hook")
  begin
    install
    @installed = true
  rescue => ex
    logger = Appsignal.logger
    logger.error("Error while installing #{name} hook: #{ex}")
    logger.debug ex.backtrace.join("\n")
  end
end