Method: TTY::Pager::ClassMethods#select_pager
- Defined in:
- lib/tty/pager.rb
#select_pager(enabled: true, command: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Select an appriopriate pager
If the user disabled paging then a NullPager is returned, otherwise a check is performed to find native system command to perform pagination with SystemPager. Finally, if no system command is found, a BasicPager is used which is a pure Ruby implementation known to work on any platform.
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/tty/pager.rb', line 84 def select_pager(enabled: true, command: nil) commands = Array(command) if !enabled NullPager elsif SystemPager.exec_available?(*commands) SystemPager else BasicPager end end |