Sha256: ef0a43434f254b112aefd05e16ed3e3cfef1c7f6ff21ea4cc6ce762169ba7327

Contents?: true

Size: 501 Bytes

Versions: 8

Compression:

Stored size: 501 Bytes

Contents

module Raven
  class LineCache
    class << self
      CACHE = {} # rubocop:disable Style/MutableConstant

      def 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

8 entries across 8 versions & 1 rubygems

Version Path
sentry-raven-2.1.4 lib/raven/linecache.rb
sentry-raven-2.1.3 lib/raven/linecache.rb
sentry-raven-2.1.2 lib/raven/linecache.rb
sentry-raven-2.1.1 lib/raven/linecache.rb
sentry-raven-2.1.0 lib/raven/linecache.rb
sentry-raven-2.0.2 lib/raven/linecache.rb
sentry-raven-2.0.1 lib/raven/linecache.rb
sentry-raven-2.0.0 lib/raven/linecache.rb