class Pry::Pager::SimplePager - pry-0.10.1 Documentation

# class Pry::Pager::SimplePager

`SimplePager` is a straightforward pure-Ruby pager. We use it on JRuby and when we can’t find a usable external pager.

### Public Class Methods

new(*) click to toggle source
Calls superclass method Pry::Pager::NullPager.new

    # File lib/pry/pager.rb, line 99
    def initialize(*)
      super
      @tracker = PageTracker.new(height - 3, width)
    end

### Public Instance Methods

write(str) click to toggle source

    # File lib/pry/pager.rb, line 104
    def write(str)
      str.lines.each do |line|
        @out.print line
        @tracker.record line

        if @tracker.page?
          @out.print "\n"
          @out.print "\e[0m"
          @out.print "<page break> --- Press enter to continue "                       "( q<enter> to break ) --- <page break>\n"
          raise StopPaging if Readline.readline("").chomp == "q"
          @tracker.reset
        end
      end
    end