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.
-
#become(klass, attributes) ⇒ Class
included
from Vedeu::Common
private
Converts one class into another.
-
#boolean(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the value was a boolean.
-
#boolean?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Boolean.
-
#by_name ⇒ Array
private
Renders the cursor in the terminal.
- #cursor ⇒ Vedeu::Cursors::Cursor private private
-
#escape?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is an escape sequence object (e.g. Vedeu::Cells::Escape.).
-
#falsy?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value should be considered false.
-
#geometry ⇒ Object
private
private
Fetch the geometry by name.
-
#hash?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Hash.
-
#initialize(name) ⇒ Vedeu::Cursors::Refresh
constructor
private
Returns a new instance of Vedeu::Cursors::Refresh.
-
#line_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::Line.
- #name ⇒ String|Symbol private private
-
#numeric?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Fixnum.
-
#present?(variable) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether a variable has a useful value.
-
#refresh_view? ⇒ Boolean
private
private
Returns true when the view should be refreshed.
-
#snake_case(klass) ⇒ String
included
from Vedeu::Common
private
Converts a class name to a lowercase snake case string.
-
#stream_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::Stream.
-
#string?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Fixnum.
-
#truthy?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value should be considered true.
-
#view_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::View.
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.
45 46 47 |
# File 'lib/vedeu/cursors/refresh.rb', line 45 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.
36 37 38 |
# File 'lib/vedeu/cursors/refresh.rb', line 36 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.
#become(klass, attributes) ⇒ Class 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 one class into another.
#boolean(value) ⇒ 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 the value was a boolean.
#boolean?(value) ⇒ 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 the value is a Boolean.
#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.
55 56 57 58 59 60 61 62 63 |
# File 'lib/vedeu/cursors/refresh.rb', line 55 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.
84 85 86 |
# File 'lib/vedeu/cursors/refresh.rb', line 84 def cursor @cursor ||= Vedeu.cursors.by_name(name) end |
#escape?(value) ⇒ 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 the value is an escape sequence object (e.g. Vedeu::Cells::Escape.)
#falsy?(value) ⇒ 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 the value should be considered false.
#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.
91 92 93 |
# File 'lib/vedeu/cursors/refresh.rb', line 91 def geometry @geometry ||= Vedeu.geometries.by_name(name) end |
#hash?(value) ⇒ 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 the value is a Hash.
#line_model? ⇒ 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 the model is a Views::Line.
#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.
68 69 70 |
# File 'lib/vedeu/cursors/refresh.rb', line 68 def name present?(@name) ? @name : Vedeu.focus end |
#numeric?(value) ⇒ 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 the value is a Fixnum.
#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? ⇒ 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.
78 79 80 |
# File 'lib/vedeu/cursors/refresh.rb', line 78 def refresh_view? visible? && (ox >= bordered_width || oy >= bordered_height) end |
#snake_case(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.
Converts a class name to a lowercase snake case string.
#stream_model? ⇒ 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 the model is a Views::Stream.
#string?(value) ⇒ 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 the value is a Fixnum.
#truthy?(value) ⇒ 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 the value should be considered true.
#view_model? ⇒ 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 the model is a Views::View.