Class: StackifyRubyAPM::Stacktrace::Frame Private

Inherits:
Object
  • Object
show all
Includes:
NaivelyHashable
Defined in:
lib/stackify_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

Instance Method Summary collapse

Methods included from NaivelyHashable

#naively_hashable?, #to_h

Instance Attribute Details

#abs_pathObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def abs_path
  @abs_path
end

#colnoObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def colno
  @colno
end

#context_lineObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def context_line
  @context_line
end

#filenameObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def filename
  @filename
end

#functionObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def function
  @function
end

#library_frameObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def library_frame
  @library_frame
end

#linenoObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def lineno
  @lineno
end

#MethodObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def Method
  @Method
end

#moduleObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def module
  @module
end

#post_contextObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def post_context
  @post_context
end

#pre_contextObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

def pre_context
  @pre_context
end

#varsObject

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.



9
10
11
# File 'lib/stackify_apm/stacktrace/frame.rb', line 9

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.



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/stackify_apm/stacktrace/frame.rb', line 24

def build_context(context_line_count)
  return unless abs_path && context_line_count.positive?

  padding = (context_line_count - 1) / 2
  from = lineno - padding - 1
  from = 0 if from.negative?
  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