Sha256: 6890074e54d3d0e4530187b3c67ac2c3a174a2946678b78a85077621003ecd1a

Contents?: true

Size: 553 Bytes

Versions: 4

Compression:

Stored size: 553 Bytes

Contents

# A much simpler source line cacher because linecache sucks at platform compat

module Raven
  class LineCache
    class << self
      CACHE = {}

      def is_valid_file(path)
        lines = getlines(path)
        return lines != nil
      end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sentry-raven-0.15.2 lib/raven/linecache.rb
sentry-raven-0.15.1 lib/raven/linecache.rb
sentry-raven-0.15.0 lib/raven/linecache.rb
sentry-raven-0.14.0 lib/raven/linecache.rb