module Airbrake::Ignorable

Ignorable contains methods that allow the includee to be ignored.

@example

class A
  include Airbrake::Ignorable
end

a = A.new
a.ignore!
a.ignored? #=> true

@since v3.2.0 @api private

Attributes

ignored[RW]

Public Instance Methods

ignore!() click to toggle source

Ignores an instance. Ignored instances must never reach the Airbrake dashboard. @return [void] @see ignored?

# File lib/airbrake-ruby/ignorable.rb, line 31
def ignore!
  self.ignored = true
end
ignored?() click to toggle source

Checks whether the instance was ignored. @return [Boolean] @see ignore! rubocop:disable Style/DoubleNegation

# File lib/airbrake-ruby/ignorable.rb, line 22
def ignored?
  !!ignored
end

Private Instance Methods

raise_if_ignored() click to toggle source

A method that is meant to be used as a guard. @raise [Airbrake::Error] when instance is ignored

# File lib/airbrake-ruby/ignorable.rb, line 39
def raise_if_ignored
  return unless ignored?
  raise Airbrake::Error, "cannot access ignored #{self.class}"
end