Class: Appsignal::Hooks::Hook
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #dependencies_present? ⇒ Boolean
-
#initialize ⇒ Hook
constructor
A new instance of Hook.
- #install ⇒ Object
- #installed? ⇒ Boolean
- #try_to_install(name) ⇒ Object
Constructor Details
#initialize ⇒ Hook
Returns a new instance of Hook.
27 28 29 |
# File 'lib/appsignal/hooks.rb', line 27 def initialize @installed = false end |
Class Method Details
Instance Method Details
#dependencies_present? ⇒ Boolean
52 53 54 |
# File 'lib/appsignal/hooks.rb', line 52 def dependencies_present? raise NotImplementedError end |
#install ⇒ Object
56 57 58 |
# File 'lib/appsignal/hooks.rb', line 56 def install raise NotImplementedError end |
#installed? ⇒ Boolean
48 49 50 |
# File 'lib/appsignal/hooks.rb', line 48 def installed? @installed end |
#try_to_install(name) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/appsignal/hooks.rb', line 31 def try_to_install(name) return unless dependencies_present? return if installed? Appsignal.internal_logger.debug("Installing #{name} hook") begin install @installed = true rescue => ex logger = Appsignal.internal_logger logger.error( "Error while installing #{name} hook: #{ex.class}: #{ex.}\n" \ "#{ex.backtrace.join("\n")}" ) end end |