Sha256: 5229bac019999dfa7226070f7b5e3b278f464477200db4c438d358b38ed6cb1e

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 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)
        !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

1 entries across 1 versions & 1 rubygems

Version Path
sentry-raven-0.15.3 lib/raven/linecache.rb