Class: Hoss::StacktraceBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hoss/stacktrace_builder.rb

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

Constant Summary collapse

JAVA_FORMAT =

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.

/^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$/.freeze
RUBY_FORMAT =

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.

/^(.+?):(\d+)(?::in `(.+?)')?$/.freeze
RUBY_VERS_REGEX =

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.

%r{ruby(/gems)?[-/](\d+\.)+\d}.freeze
JRUBY_ORG_REGEX =

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.

%r{org/jruby}.freeze
GEMS_PATH =

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.

if defined?(Bundler) && Bundler.default_bundle_dir
  Bundler.bundle_path.to_s
else
  Gem.dir
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ StacktraceBuilder

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 a new instance of StacktraceBuilder.



39
40
41
42
# File 'lib/hoss/stacktrace_builder.rb', line 39

def initialize(config)
  @config = config
  @cache = Util::LruCache.new(2048, &method(:build_frame))
end

Instance Attribute Details

#configObject (readonly)

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.



44
45
46
# File 'lib/hoss/stacktrace_builder.rb', line 44

def config
  @config
end

Instance Method Details

#build(backtrace, type:) ⇒ Object

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.



46
47
48
49
50
51
52
# File 'lib/hoss/stacktrace_builder.rb', line 46

def build(backtrace, type:)
  Stacktrace.new.tap do |s|
    s.frames = backtrace[0...config.stack_trace_limit].map do |line|
      @cache[[line, type]]
    end
  end
end