Class: Raven::LineCache
- Inherits:
-
Object
- Object
- Raven::LineCache
- Defined in:
- lib/raven/linecache.rb
Constant Summary collapse
- CACHE =
{}
Class Method Summary collapse
Class Method Details
.getline(path, n) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/raven/linecache.rb', line 21 def getline(path, n) return nil if n < 1 lines = getlines(path) return nil if lines == nil lines[n - 1] end |
.getlines(path) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/raven/linecache.rb', line 13 def getlines(path) CACHE[path] ||= begin IO.readlines(path) rescue nil end end |
.is_valid_file(path) ⇒ Object
8 9 10 11 |
# File 'lib/raven/linecache.rb', line 8 def is_valid_file(path) lines = getlines(path) return lines != nil end |