lib/pdk/report/event.rb
def context_lines(max_num_lines = 5)
        return if file.nil? || line.nil?

        file_content = File.read(file).split("\n")
        delta = (max_num_lines - 1) / 2
        min = [0, (line - 1) - delta].max
        max = [(line - 1) + delta, file_content.length].min

        file_content[min..max].map { |r| "  #{r}" }
      end
# Extract contextual information for the event from the file that it
# references.
#
# @param max_num_lines [Integer] The maximum number of lines to return.
#
# @return [Array] Array of lines from the file, centred on the line
#   number of the event.
Extract contextual information for the event from the file that it
references.
Extract contextual information for the event from the file that it references .
def context_lines(max_num_lines = 5)
        return if file.nil? || line.nil?
        file_content = File.read(file).split("\n")
        delta = (max_num_lines - 1) / 2
        min = [0, (line - 1) - delta].max
        max = [(line - 1) + delta, file_content.length].min
        file_content[min..max].map { |r| "  #{r}" }
      end
def context_lines ( max_num_lines = 5 ) return if file . nil? || line . nil? file_content = File . read ( file ) . split ( "\n" ) delta = ( max_num_lines - 1 ) / 2 min = [ 0 , ( line - 1 ) - delta ] . max max = [ ( line - 1 ) + delta , file_content . length ] . min file_content [ min .. max ] . map { | r | "  #{r}" } end
Extract contextual information for the event from the file that it
references.
Extract contextual information for the event from the file that it references .
Array of lines from the file, centred on the line number of the event.
Array of lines from the file centred on the line number of the event .
Array
max_num_lines
The maximum number of lines to return.
The maximum number of lines to return .