Class: Toys::Utils::Pager
- Inherits:
-
Object
- Object
- Toys::Utils::Pager
- Defined in:
- core-docs/toys/utils/pager.rb
Overview
Defined in the toys-core gem
A class that invokes an external pager.
Instance Attribute Summary collapse
-
#command ⇒ String, ...
The command for running the pager process.
-
#fallback_io ⇒ IO
The IO stream used if the pager is disabled or could not be executed.
Class Method Summary collapse
-
.start(command: true, exec_service: nil, fallback_io: nil, rescue_broken_pipes: true, &block) ⇒ Integer
A convenience method that creates a pager and runs it once by calling #start.
Instance Method Summary collapse
-
#initialize(command: true, exec_service: nil, fallback_io: nil, rescue_broken_pipes: true) ⇒ Pager
constructor
Creates a new pager.
-
#start {|io| ... } ⇒ Integer
Runs the pager.
Constructor Details
#initialize(command: true, exec_service: nil, fallback_io: nil, rescue_broken_pipes: true) ⇒ Pager
Creates a new pager.
40 41 42 43 |
# File 'core-docs/toys/utils/pager.rb', line 40 def initialize(command: true, exec_service: nil, fallback_io: nil, rescue_broken_pipes: true) # Source available in the toys-core gem end |
Instance Attribute Details
#command ⇒ String, ...
The command for running the pager process. May be specified as a string
to be passed to the shell, an array of strings representing a posix
command, or nil to disable the pager and write directly to an output
stream.
72 73 74 |
# File 'core-docs/toys/utils/pager.rb', line 72 def command @command end |
#fallback_io ⇒ IO
The IO stream used if the pager is disabled or could not be executed.
79 80 81 |
# File 'core-docs/toys/utils/pager.rb', line 79 def fallback_io @fallback_io end |
Class Method Details
.start(command: true, exec_service: nil, fallback_io: nil, rescue_broken_pipes: true, &block) ⇒ Integer
A convenience method that creates a pager and runs it once by calling #start.
108 109 110 111 112 113 114 |
# File 'core-docs/toys/utils/pager.rb', line 108 def start(command: true, exec_service: nil, fallback_io: nil, rescue_broken_pipes: true, &block) # Source available in the toys-core gem end |
Instance Method Details
#start {|io| ... } ⇒ Integer
Runs the pager. Takes a block and yields an IO-like object that passes text to the pager. Can be called multiple times on the same pager.
60 61 62 |
# File 'core-docs/toys/utils/pager.rb', line 60 def start # Source available in the toys-core gem end |