# class Raven::LineCache

### Public Class Methods

new() click to toggle source

    # File sentry-raven/lib/raven/linecache.rb, line 3
    def initialize
      @cache = {}
    end

### Public Instance Methods

get_file_context(filename, lineno, context) click to toggle source

Any linecache you provide to `Raven` must implement this method. Returns an `Array` of Strings representing the lines in the source file. The number of lines retrieved is (2 * context) + 1, the middle line should be the line requested by lineno. See specs for more information.

    # File sentry-raven/lib/raven/linecache.rb, line 11
    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