class Pry::Pager
def best_available
you must rescue `Pry::Pager::StopPaging`. These requirements can be
must call `#close` when you're done writing output to a pager, and
pagers accept output with `#puts`, `#print`, `#write`, and `#<<`. You
available, and `NullPager` if the user has disabled paging. All
`SystemPager` if possible, `SimplePager` if `SystemPager` isn't
Return an instance of the "best" available pager class --
def best_available if !pry_instance.config.pager NullPager.new(pry_instance.output) elsif !SystemPager.available? || Helpers::Platform.jruby? SimplePager.new(pry_instance.output) else SystemPager.new(pry_instance.output) end end
def enabled?
def enabled? !!@enabled end
def initialize(pry_instance)
def initialize(pry_instance) @pry_instance = pry_instance end
def open
Yields a pager object (`NullPager`, `SimplePager`, or `SystemPager`).
def open pager = best_available yield pager rescue StopPaging # rubocop:disable Lint/HandleExceptions ensure pager.close if pager end
def page(text)
-
text
(String
) --
def page(text) open do |pager| pager << text end end