class Sentry::LineCache
def get_file_context(filename, lineno, context)
file. The number of lines retrieved is (2 * context) + 1, the middle
Returns an Array of Strings representing the lines in the source
Any linecache you provide to Sentry must implement this method.
def get_file_context(filename, lineno, context) return nil, nil, nil unless valid_path?(filename) lines = Array.new(2 * context + 1) do |i| getline(filename, lineno - context + i) end [lines[0..(context - 1)], lines[context], lines[(context + 1)..-1]] end