class Pry::Pager::MindControlPager

Custom SimplePager based pager that uses MindConrol's IO (not host).

Public Class Methods

new( input, output ) click to toggle source

@param [IO] input console input @param [IO] output console output

Calls superclass method
# File lib/mind_control/pry_monkey_patches.rb, line 25
def initialize( input, output )
  super( output )

  @in = input
  @tracker = PageTracker.new( height - 3, width )
end

Public Instance Methods

write( str ) click to toggle source

Writes string to console with pagination. @param [String] str

# File lib/mind_control/pry_monkey_patches.rb, line 36
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 @in.readline( "" ).chomp == "q"

      @tracker.reset
    end
  end
end