class Raven::LineCache
Constants
- CACHE
TODO: a constant isn't appropriate here, refactor also would there be threading bugs essentially using this as a class variable?
Public Class Methods
getline(path, n)
click to toggle source
# File lib/raven/linecache.rb, line 24 def getline(path, n) return nil if n < 1 lines = getlines(path) return nil if lines.nil? lines[n - 1] end
getlines(path)
click to toggle source
# File lib/raven/linecache.rb, line 16 def getlines(path) CACHE[path] ||= begin IO.readlines(path) rescue nil end end
is_valid_file(path)
click to toggle source
# File lib/raven/linecache.rb, line 11 def is_valid_file(path) lines = getlines(path) !lines.nil? end