Module: Isolator::Adapters::Base
- Defined in:
- lib/isolator/adapters/base.rb
Overview
Used as a “template” for adapters
Instance Attribute Summary collapse
-
#exception_class ⇒ Object
Returns the value of attribute exception_class.
-
#exception_message ⇒ Object
Returns the value of attribute exception_message.
Instance Method Summary collapse
- #disable! ⇒ Object
- #disabled? ⇒ Boolean
- #enable! ⇒ Object
- #enabled? ⇒ Boolean
- #ignore_if ⇒ Object
- #ignored?(*args) ⇒ Boolean
- #ignores ⇒ Object
- #notify(backtrace, *args) ⇒ Object
- #notify?(*args) ⇒ Boolean
Instance Attribute Details
#exception_class ⇒ Object
Returns the value of attribute exception_class.
7 8 9 |
# File 'lib/isolator/adapters/base.rb', line 7 def exception_class @exception_class end |
#exception_message ⇒ Object
Returns the value of attribute exception_message.
7 8 9 |
# File 'lib/isolator/adapters/base.rb', line 7 def end |
Instance Method Details
#disable! ⇒ Object
9 10 11 |
# File 'lib/isolator/adapters/base.rb', line 9 def disable! @disabled = true end |
#disabled? ⇒ Boolean
21 22 23 |
# File 'lib/isolator/adapters/base.rb', line 21 def disabled? @disabled == true end |
#enable! ⇒ Object
13 14 15 |
# File 'lib/isolator/adapters/base.rb', line 13 def enable! @disabled = false end |
#enabled? ⇒ Boolean
17 18 19 |
# File 'lib/isolator/adapters/base.rb', line 17 def enabled? !disabled? end |
#ignore_if ⇒ Object
34 35 36 |
# File 'lib/isolator/adapters/base.rb', line 34 def ignore_if ignores << Proc.new end |
#ignored?(*args) ⇒ Boolean
42 43 44 |
# File 'lib/isolator/adapters/base.rb', line 42 def ignored?(*args) ignores.any? { |block| block.call(*args) } end |
#ignores ⇒ Object
38 39 40 |
# File 'lib/isolator/adapters/base.rb', line 38 def ignores @ignores ||= [] end |
#notify(backtrace, *args) ⇒ Object
25 26 27 28 |
# File 'lib/isolator/adapters/base.rb', line 25 def notify(backtrace, *args) return unless notify?(*args) Isolator.notify(exception: build_exception, backtrace: backtrace) end |
#notify?(*args) ⇒ Boolean
30 31 32 |
# File 'lib/isolator/adapters/base.rb', line 30 def notify?(*args) enabled? && Isolator.enabled? && Isolator.within_transaction? && !ignored?(*args) end |