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
-
#absent?(variable) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether a variable is nil or empty.
-
#border ⇒ Object
private
private
Fetch the border by name.
-
#by_name ⇒ Array
private
Renders the cursor in the terminal.
- #cursor ⇒ Vedeu::Cursors::Cursor private private
-
#demodulize(klass) ⇒ String
included
from Vedeu::Common
private
Removes the module part from the expression in the string.
-
#initialize(name) ⇒ Vedeu::Cursors::Refresh
constructor
private
Returns a new instance of Vedeu::Cursors::Refresh.
- #name ⇒ String|Symbol private private
-
#present?(variable) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether a variable has a useful value.
- #refresh_view ⇒ void private private
-
#refresh_view? ⇒ Boolean
private
private
Returns true when the view should be refreshed.
-
#snake_case(name) ⇒ String
included
from Vedeu::Common
private
Converts a class name to a lowercase snake case string.
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.
34 35 36 |
# File 'lib/vedeu/cursors/refresh.rb', line 34 def initialize(name) @name = name end |
Class Method Details
.by_name(name = Vedeu.focus) ⇒ 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.
25 26 27 |
# File 'lib/vedeu/cursors/refresh.rb', line 25 def self.by_name(name = Vedeu.focus) new(name).by_name end |
Instance Method Details
#absent?(variable) ⇒ Boolean Originally defined in module Vedeu::Common
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 boolean indicating whether a variable is nil or empty.
#border ⇒ 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.
Borders::Border is used in this way because when there is not a border defined, it will fallback to a Borders::Null which uses Geometry::Geometry to determine it’s dimensions based on the name also. When a Geometry::Geometry cannot be found, this falls back to a Geometry::Null which uses the dimensions of the current terminal.
Fetch the border by name.
90 91 92 |
# File 'lib/vedeu/cursors/refresh.rb', line 90 def border @border ||= Vedeu.borders.by_name(name) end |
#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.
44 45 46 47 48 |
# File 'lib/vedeu/cursors/refresh.rb', line 44 def by_name refresh_view if refresh_view? cursor.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.
73 74 75 |
# File 'lib/vedeu/cursors/refresh.rb', line 73 def cursor @cursor ||= Vedeu.cursors.by_name(name) end |
#demodulize(klass) ⇒ String Originally defined in module Vedeu::Common
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.
Removes the module part from the expression in the string.
#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.
53 54 55 |
# File 'lib/vedeu/cursors/refresh.rb', line 53 def name present?(@name) ? @name : Vedeu.focus end |
#present?(variable) ⇒ Boolean Originally defined in module Vedeu::Common
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 boolean indicating whether a variable has a useful value.
#refresh_view ⇒ void (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.
This method returns an undefined value.
58 59 60 |
# File 'lib/vedeu/cursors/refresh.rb', line 58 def refresh_view Vedeu.trigger(:_refresh_view_content_, name) 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 width and height of the named interface.
67 68 69 |
# File 'lib/vedeu/cursors/refresh.rb', line 67 def refresh_view? cursor.visible? && cursor.ox >= width || cursor.oy >= height end |
#snake_case(name) ⇒ String Originally defined in module Vedeu::Common
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.
Converts a class name to a lowercase snake case string.