Sha256: 2cd564ac4ea9ac311600efb32204ae8cb18d626b49311c8a0967f5e69cecb7c3

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

module Sentry
  class ThreadsInterface
    def initialize(crashed: false, stacktrace: nil)
      @id = Thread.current.object_id
      @name = Thread.current.name
      @current = true
      @crashed = crashed
      @stacktrace = stacktrace
    end

    def to_hash
      {
        values: [
          {
            id: @id,
            name: @name,
            crashed: @crashed,
            current: @current,
            stacktrace: @stacktrace&.to_hash
          }
        ]
      }
    end

    # patch this method if you want to change a threads interface's stacktrace frames
    # also see `StacktraceBuilder.build`.
    def self.build(backtrace:, stacktrace_builder:, **options)
      stacktrace = stacktrace_builder.build(backtrace: backtrace) if backtrace
      new(**options, stacktrace: stacktrace)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sentry-ruby-core-4.8.3 lib/sentry/interfaces/threads.rb
sentry-ruby-core-4.8.2 lib/sentry/interfaces/threads.rb
sentry-ruby-core-4.8.1 lib/sentry/interfaces/threads.rb