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
Returns the named cursor from the cursors repository.
-
#geometry ⇒ Vedeu::Geometries::Geometry
private
private
Returns the named geometry from the geometries repository.
-
#initialize(name) ⇒ Vedeu::Cursors::Refresh
constructor
private
Returns a new instance of Vedeu::Cursors::Refresh.
-
#name ⇒ NilClass|Symbol|String
private
private
The name of the model, the target model or the name of the associated model.
-
#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.
41 42 43 |
# File 'lib/vedeu/cursors/refresh.rb', line 41 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.
51 52 53 54 55 56 57 58 |
# File 'lib/vedeu/cursors/refresh.rb', line 51 def by_name Vedeu.log(type: :cursor, message: "Refreshing cursor: (#{cursor.inspect})") render Vedeu.trigger(:_refresh_view_content_, name) if refresh_view? 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.
Returns the named cursor from the cursors repository.
78 79 80 |
# File 'lib/vedeu/cursors/refresh.rb', line 78 def cursor @_cursor ||= Vedeu.cursors.by_name(name) end |
#geometry ⇒ Vedeu::Geometries::Geometry (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 the named geometry from the geometries repository.
83 84 85 |
# File 'lib/vedeu/cursors/refresh.rb', line 83 def geometry @_geometry ||= Vedeu.geometries.by_name(name) end |
#name ⇒ NilClass|Symbol|String (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 The name of the model, the target model or the name of the associated model.
63 64 65 |
# File 'lib/vedeu/cursors/refresh.rb', line 63 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.
73 74 75 |
# File 'lib/vedeu/cursors/refresh.rb', line 73 def refresh_view? visible? && (ox >= bordered_width || oy >= bordered_height) end |