Class: Raven::LineCache

Inherits:
Object
  • Object
show all
Defined in:
lib/raven/linecache.rb

Constant Summary collapse

CACHE =
{}

Class Method Summary collapse

Class Method Details

.getline(path, n) ⇒ Object



16
17
18
19
# File 'lib/raven/linecache.rb', line 16

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

.getlines(path) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/raven/linecache.rb', line 8

def getlines(path)
  CACHE[path] ||= begin
    IO.readlines(path)
  rescue
    []
  end
end