Module: Toys::StandardMixins::Pager
- Includes:
- Mixin
- Defined in:
- lib/toys/standard_mixins/pager.rb
Overview
A mixin that provides a pager.
This mixin provides an instance of Utils::Pager, which invokes an external pager for output.
Constant Summary collapse
- KEY =
Context key for the Pager object.
::Object.new.freeze
Instance Method Summary collapse
-
#pager(&block) ⇒ Toys::Utils::Pager, Integer
Access the Pager.
Methods included from Mixin
Instance Method Details
#pager(&block) ⇒ Toys::Utils::Pager, Integer
Access the Pager.
If no block is given, returns the pager object.
If a block is given, the pager is executed with the given block, and the exit code of the pager process is returned.
41 42 43 44 45 |
# File 'lib/toys/standard_mixins/pager.rb', line 41 def pager(&block) pager = self[KEY] return pager unless block self[KEY].start(&block) end |