lines_around(file, line) public

No documentation

This method has no description. You can help the RSpec community by adding new notes.

Hide source
# File lib/spec/runner/formatter/snippet_extractor.rb, line 26
        def lines_around(file, line)
          if File.file?(file)
            lines = File.open(file).read.split("\n")
            min = [0, line-3].max
            max = [line+1, lines.length-1].min
            selected_lines = []
            selected_lines.join("\n")
            lines[min..max].join("\n")
          else
            "# Couldn't get snippet for #{file}"
          end
        end
Register or log in to add new notes.