Class: TTY::Terminal::BasicPager
- Defined in:
- lib/tty/terminal/pager/basic.rb
Overview
A class responsible for paging text
Constant Summary collapse
- PROMPT_HEIGHT =
3- PAGE_BREAK =
'--- Press enter/return to continue (or q to quit) ---'
Instance Attribute Summary
Attributes inherited from Pager
Instance Method Summary collapse
-
#page ⇒ Object
Use ruby to page output text.
Methods inherited from Pager
available, available?, command, #enabled?, executables, #initialize, page
Constructor Details
This class inherits a constructor from TTY::Terminal::Pager
Instance Method Details
#page ⇒ Object
Use ruby to page output text
14 15 16 17 18 19 20 21 22 |
# File 'lib/tty/terminal/pager/basic.rb', line 14 def page text_lines = text.lines.to_a text_lines.each_slice(page_size) do |chunk| TTY.shell.say chunk.join break if chunk.size < page_size break if !continue?(text_lines) end end |