Class: TTY::Pager::BasicPager::PageCursor Private
- Inherits:
-
Object
- Object
- TTY::Pager::BasicPager::PageCursor
- Defined in:
- lib/tty/pager/basic.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Tracks page cursor
Instance Attribute Summary collapse
- #page_num ⇒ Object readonly private
Instance Method Summary collapse
-
#down_by(count) ⇒ Object
Move coursor down the page by count.
-
#initialize(height) ⇒ PageCursor
constructor
private
A new instance of PageCursor.
-
#next_page ⇒ Object
Move cursor to the next page.
-
#page_break? ⇒ Boolean
private
Check if time to break a page.
- #reset ⇒ Object private
Constructor Details
#initialize(height) ⇒ PageCursor
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.
Returns a new instance of PageCursor.
97 98 99 100 |
# File 'lib/tty/pager/basic.rb', line 97 def initialize(height) @height = height reset end |
Instance Attribute Details
#page_num ⇒ Object (readonly)
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.
95 96 97 |
# File 'lib/tty/pager/basic.rb', line 95 def page_num @page_num end |
Instance Method Details
#down_by(count) ⇒ Object
Move coursor down the page by count
120 121 122 |
# File 'lib/tty/pager/basic.rb', line 120 def down_by(count) @lines_left -= count end |
#next_page ⇒ Object
Move cursor to the next page
110 111 112 113 |
# File 'lib/tty/pager/basic.rb', line 110 def next_page @page_num += 1 @lines_left = @height end |
#page_break? ⇒ Boolean
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.
Check if time to break a page
129 130 131 |
# File 'lib/tty/pager/basic.rb', line 129 def page_break? @lines_left.zero? end |
#reset ⇒ 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.
102 103 104 105 |
# File 'lib/tty/pager/basic.rb', line 102 def reset @page_num = 1 @lines_left = @height end |