Sha256: 6e6c069762b0c977fddeea3cdcb17f1563c02b809754b6c5966c27a5d86cf27d

Contents?: true

Size: 421 Bytes

Versions: 13

Compression:

Stored size: 421 Bytes

Contents

module CrashLog
  class Backtrace
    class LineCache
      class << self
        CACHE = {}

        def getlines(path)
          CACHE[path] ||= begin
            IO.readlines(path).map { |line| line.chomp.gsub(/[']/, '\\\\\'') }
          rescue
            []
          end
        end

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

      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
crashlog-1.1.0.pre1 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.7 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.6 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.5 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.4 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.3 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.2.1 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.2 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.1 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.0 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.0.rc2 lib/crash_log/backtrace/line_cache.rb
crashlog-1.0.0.rc1 lib/crash_log/backtrace/line_cache.rb
crashlog-0.0.2 lib/crash_log/backtrace/line_cache.rb