method
lines_around
lines_around(file, line)
public
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