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



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

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

.getlines(path) ⇒ Object



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

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