Class: Sentry::StacktraceInterface::Frame
- Defined in:
- lib/sentry/interfaces/stacktrace.rb
Overview
Not actually an interface, but I want to use the same style
Instance Attribute Summary collapse
-
#abs_path ⇒ Object
Returns the value of attribute abs_path.
-
#context_line ⇒ Object
Returns the value of attribute context_line.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#function ⇒ Object
Returns the value of attribute function.
-
#in_app ⇒ Object
Returns the value of attribute in_app.
-
#lineno ⇒ Object
Returns the value of attribute lineno.
-
#module ⇒ Object
Returns the value of attribute module.
-
#post_context ⇒ Object
Returns the value of attribute post_context.
-
#pre_context ⇒ Object
Returns the value of attribute pre_context.
-
#vars ⇒ Object
Returns the value of attribute vars.
Instance Method Summary collapse
-
#initialize(project_root, line, strip_backtrace_load_path = true, filename_cache: nil) ⇒ Frame
constructor
A new instance of Frame.
- #set_context(linecache, context_lines) ⇒ Object
- #to_h(*args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(project_root, line, strip_backtrace_load_path = true, filename_cache: nil) ⇒ Frame
Returns a new instance of Frame.
30 31 32 33 34 35 36 37 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 30 def initialize(project_root, line, strip_backtrace_load_path = true, filename_cache: nil) @abs_path = line.file @function = line.method if line.method @lineno = line.number @in_app = line.in_app @module = line.module_name if line.module_name @filename = filename_cache&.compute_filename(@abs_path, @in_app, strip_backtrace_load_path) end |
Instance Attribute Details
#abs_path ⇒ Object
Returns the value of attribute abs_path.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def abs_path @abs_path end |
#context_line ⇒ Object
Returns the value of attribute context_line.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def context_line @context_line end |
#filename ⇒ Object
Returns the value of attribute filename.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def filename @filename end |
#function ⇒ Object
Returns the value of attribute function.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def function @function end |
#in_app ⇒ Object
Returns the value of attribute in_app.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def in_app @in_app end |
#lineno ⇒ Object
Returns the value of attribute lineno.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def lineno @lineno end |
#module ⇒ Object
Returns the value of attribute module.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def module @module end |
#post_context ⇒ Object
Returns the value of attribute post_context.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def post_context @post_context end |
#pre_context ⇒ Object
Returns the value of attribute pre_context.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def pre_context @pre_context end |
#vars ⇒ Object
Returns the value of attribute vars.
27 28 29 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 27 def vars @vars end |
Instance Method Details
#set_context(linecache, context_lines) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 43 def set_context(linecache, context_lines) return unless abs_path @pre_context, @context_line, @post_context = \ linecache.get_file_context(abs_path, lineno, context_lines) end |
#to_h(*args) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 50 def to_h(*args) data = super(*args) data.delete(:vars) unless vars && !vars.empty? data.delete(:pre_context) unless pre_context && !pre_context.empty? data.delete(:post_context) unless post_context && !post_context.empty? data.delete(:context_line) unless context_line && !context_line.empty? data end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/sentry/interfaces/stacktrace.rb', line 39 def to_s "#{@filename}:#{@lineno}" end |