Class: Vedeu::Cursors::Refresh Private
- Inherits:
-
Object
- Object
- Vedeu::Cursors::Refresh
- Extended by:
- Forwardable
- Includes:
- Vedeu::Common
- Defined in:
- lib/vedeu/cursors/refresh.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.
Handle the refreshing (redrawing) of a cursor, without redrawing the whole interface; unless the cursor’s offset has caused the view to change.
Class Method Summary collapse
Instance Method Summary collapse
-
#by_name ⇒ Array
private
Renders the cursor in the terminal.
- #cursor ⇒ Vedeu::Cursors::Cursor private private
-
#geometry ⇒ Object
private
private
Fetch the geometry by name.
-
#initialize(name) ⇒ Vedeu::Cursors::Refresh
constructor
private
Returns a new instance of Vedeu::Cursors::Refresh.
- #name ⇒ String|Symbol private private
-
#refresh_view? ⇒ Boolean
private
private
Returns true when the view should be refreshed.
Methods included from Vedeu::Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Constructor Details
#initialize(name) ⇒ Vedeu::Cursors::Refresh
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 Vedeu::Cursors::Refresh.
44 45 46 |
# File 'lib/vedeu/cursors/refresh.rb', line 44 def initialize(name) @name = name end |
Class Method Details
Instance Method Details
#by_name ⇒ Array
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.
Renders the cursor in the terminal. If the cursor’s x or y offsets are greater or equal to the interface’s width or height respectively, then the view is also refreshed, causing the content to be offset also.
54 55 56 57 58 59 60 61 62 |
# File 'lib/vedeu/cursors/refresh.rb', line 54 def by_name Vedeu.trigger(:_refresh_view_content_, name) if refresh_view? Vedeu.log(type: :cursor, message: "Refreshing cursor: '#{name}' (x:#{x}, y:#{y}, " \ "ox:#{ox}, oy:#{oy}, visible:#{visible})") render end |
#cursor ⇒ Vedeu::Cursors::Cursor (private)
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.
83 84 85 |
# File 'lib/vedeu/cursors/refresh.rb', line 83 def cursor @cursor ||= Vedeu.cursors.by_name(name) end |
#geometry ⇒ Object (private)
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.
Fetch the geometry by name.
90 91 92 |
# File 'lib/vedeu/cursors/refresh.rb', line 90 def geometry @geometry ||= Vedeu.geometries.by_name(name) end |
#name ⇒ String|Symbol (private)
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.
67 68 69 |
# File 'lib/vedeu/cursors/refresh.rb', line 67 def name present?(@name) ? @name : Vedeu.focus end |
#refresh_view? ⇒ Boolean (private)
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 true when the view should be refreshed. This is determined by checking that the offsets for x and y are outside the (bordered) width and (bordered) height of the named interface.
77 78 79 |
# File 'lib/vedeu/cursors/refresh.rb', line 77 def refresh_view? visible? && (ox >= bordered_width || oy >= bordered_height) end |