File: custom_inspection.rb

package info (click to toggle)
ruby-sentry-ruby 5.18.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 564 kB
  • sloc: ruby: 4,701; makefile: 8; sh: 4
file content (14 lines) | stat: -rw-r--r-- 393 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

module Sentry
  module CustomInspection
    def inspect
      attr_strings = (instance_variables - self.class::SKIP_INSPECTION_ATTRIBUTES).each_with_object([]) do |attr, result|
        value = instance_variable_get(attr)
        result << "#{attr}=#{value.inspect}" if value
      end

      "#<#{self.class.name} #{attr_strings.join(", ")}>"
    end
  end
end