Module: Airbrake::Inspectable Private

Included in:
DeployNotifier, NoticeNotifier, PerformanceNotifier
Defined in:
lib/airbrake-ruby/inspectable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Inspectable provides custom inspect methods that reduce clutter printed in REPLs for notifier objects. These custom methods display only essential information such as project id/key and filters.

Since:

  • v3.2.6

Constant Summary collapse

INSPECT_TEMPLATE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Returns inspect output template.

Returns:

  • (String)

    inspect output template

Since:

  • v3.2.6

"#<%<classname>s:0x%<id>s project_id=\"%<project_id>s\" " \
"project_key=\"%<project_key>s\" " \
"host=\"%<host>s\" filter_chain=%<filter_chain>s>".freeze

Instance Method Summary collapse

Instance Method Details

#inspectString

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 customized inspect to lessen the amount of clutter.

Returns:

  • (String)

    customized inspect to lessen the amount of clutter

Since:

  • v3.2.6



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/airbrake-ruby/inspectable.rb', line 16

def inspect
  format(
    INSPECT_TEMPLATE,
    classname: self.class.name,
    id: (object_id << 1).to_s(16).rjust(16, '0'),
    project_id: @config.project_id,
    project_key: @config.project_key,
    host: @config.host,
    filter_chain: @filter_chain.inspect,
  )
end

#pretty_print(q) ⇒ String

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 #inspect for PrettyPrint.

Returns:

Since:

  • v3.2.6



29
30
31
32
33
34
35
36
37
# File 'lib/airbrake-ruby/inspectable.rb', line 29

def pretty_print(q)
  q.text("#<#{self.class}:0x#{(object_id << 1).to_s(16).rjust(16, '0')} ")
  q.text(
    "project_id=\"#{@config.project_id}\" project_key=\"#{@config.project_key}\" " \
    "host=\"#{@config.host}\" filter_chain=",
  )
  q.pp(@filter_chain)
  q.text('>')
end