Class: ElasticAPM::Stacktrace::Frame Private
- Inherits:
-
Object
- Object
- ElasticAPM::Stacktrace::Frame
- Includes:
- NaivelyHashable
- Defined in:
- lib/elastic_apm/stacktrace/frame.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.
Instance Attribute Summary collapse
- #abs_path ⇒ Object private
- #colno ⇒ Object private
- #context_line ⇒ Object private
- #filename ⇒ Object private
- #function ⇒ Object private
- #library_frame ⇒ Object private
- #lineno ⇒ Object private
- #module ⇒ Object private
- #post_context ⇒ Object private
- #pre_context ⇒ Object private
- #vars ⇒ Object private
Instance Method Summary collapse
-
#build_context(context_line_count) ⇒ Object
private
rubocop:disable Metrics/AbcSize.
Methods included from NaivelyHashable
Instance Attribute Details
#abs_path ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def abs_path @abs_path end |
#colno ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def colno @colno end |
#context_line ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def context_line @context_line end |
#filename ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def filename @filename end |
#function ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def function @function end |
#library_frame ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def library_frame @library_frame end |
#lineno ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def lineno @lineno end |
#module ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def module @module end |
#post_context ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def post_context @post_context end |
#pre_context ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def pre_context @pre_context end |
#vars ⇒ 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.
11 12 13 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 11 def vars @vars end |
Instance Method Details
#build_context(context_line_count) ⇒ 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.
rubocop:disable Metrics/AbcSize
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/elastic_apm/stacktrace/frame.rb', line 26 def build_context(context_line_count) return unless abs_path && context_line_count > 0 padding = (context_line_count - 1) / 2 from = lineno - padding - 1 from = 0 if from < 0 to = lineno + padding - 1 file_lines = read_lines(abs_path, from..to) self.context_line = file_lines[padding] self.pre_context = file_lines.first(padding) self.post_context = file_lines.last(padding) end |