class Sentry::LineCache

@api private

def get_file_context(filename, lineno, context)

line should be the line requested by lineno. See specs for more information.
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

def getline(path, n)

def getline(path, n)
  return nil if n < 1
  lines = getlines(path)
  return nil if lines.nil?
  lines[n - 1]
end

def getlines(path)

def getlines(path)
  @cache[path] ||= begin
    IO.readlines(path)
                   rescue
                     nil
  end
end

def initialize

def initialize
  @cache = {}
end

def valid_path?(path)

def valid_path?(path)
  lines = getlines(path)
  !lines.nil?
end