Class: Salopulse::StackFrameBuilder
- Inherits:
-
Object
- Object
- Salopulse::StackFrameBuilder
- Defined in:
- lib/salopulse/stack_frame_builder.rb
Constant Summary collapse
- BACKTRACE_LINE =
/\A(?<file>.+?):(?<line>\d+):in\s+[`'](?<method>.+?)['`]\z/- CONTEXT_LINES =
5- MAX_FRAMES =
50- FRAMEWORK_MARKERS =
[ "/gems/", "/rubygems/", "/bundle/" ].freeze
- SOURCE_CACHE =
{}
- SOURCE_CACHE_MUTEX =
Mutex.new
- SOURCE_CACHE_LIMIT =
512
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(backtrace, app_root:) ⇒ StackFrameBuilder
constructor
A new instance of StackFrameBuilder.
Constructor Details
#initialize(backtrace, app_root:) ⇒ StackFrameBuilder
Returns a new instance of StackFrameBuilder.
16 17 18 19 |
# File 'lib/salopulse/stack_frame_builder.rb', line 16 def initialize(backtrace, app_root:) @backtrace = Array(backtrace) @app_root = app_root && File.(app_root.to_s) end |
Class Method Details
.call(backtrace, app_root: nil) ⇒ Object
12 13 14 |
# File 'lib/salopulse/stack_frame_builder.rb', line 12 def self.call(backtrace, app_root: nil) new(backtrace, app_root: app_root).call end |
Instance Method Details
#call ⇒ Object
21 22 23 24 |
# File 'lib/salopulse/stack_frame_builder.rb', line 21 def call frames = @backtrace.first(MAX_FRAMES).filter_map { |line| build_frame(line.to_s) } dedupe_consecutive(frames) end |