Class: Vedeu::Cursors::Move Private
- Inherits:
-
Object
- Object
- Vedeu::Cursors::Move
- Extended by:
- Forwardable
- Defined in:
- lib/vedeu/cursors/move.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.
Provides the mechanism to move a named cursor in a given direction.
Instance Attribute Summary collapse
-
#direction ⇒ Symbol
readonly
protected
private
The direction to move the cursor.
-
#name ⇒ String|Symbol
readonly
protected
private
The name of the cursor.
-
#offset ⇒ Symbol
readonly
protected
private
The number of characters to move the cursor in the given direction.
Class Method Summary collapse
Instance Method Summary collapse
- #cursor ⇒ Vedeu::Cursors::Cursor private private
- #initialize(name, direction, offset) ⇒ Vedeu::Cursors::Move constructor private
- #move ⇒ NilClass|Vedeu::Cursors::Cursor private
- #valid_direction? ⇒ Boolean private private
Constructor Details
#initialize(name, direction, offset) ⇒ Vedeu::Cursors::Move
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.
29 30 31 32 33 |
# File 'lib/vedeu/cursors/move.rb', line 29 def initialize(name, direction, offset) @name = name @direction = direction @offset = offset end |
Instance Attribute Details
#direction ⇒ Symbol (readonly, protected)
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 direction to move the cursor.
52 53 54 |
# File 'lib/vedeu/cursors/move.rb', line 52 def direction @direction end |
#name ⇒ String|Symbol (readonly, protected)
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 cursor.
48 49 50 |
# File 'lib/vedeu/cursors/move.rb', line 48 def name @name end |
#offset ⇒ Symbol (readonly, protected)
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 number of characters to move the cursor in the given direction.
57 58 59 |
# File 'lib/vedeu/cursors/move.rb', line 57 def offset @offset end |
Class Method Details
.move(name, direction, offset) ⇒ NilClass|Vedeu::Cursors::Cursor
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.
21 22 23 |
# File 'lib/vedeu/cursors/move.rb', line 21 def self.move(name, direction, offset) new(name, direction, offset).move end |
Instance Method Details
#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.
62 63 64 |
# File 'lib/vedeu/cursors/move.rb', line 62 def cursor @_cursor ||= Vedeu.cursors.by_name(name) end |
#move ⇒ NilClass|Vedeu::Cursors::Cursor
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 39 40 41 42 |
# File 'lib/vedeu/cursors/move.rb', line 36 def move return nil unless visible? && valid_direction? cursor.public_send(direction, offset) cursor.store { Vedeu.trigger(:_refresh_cursor_, name) } cursor end |
#valid_direction? ⇒ 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.
67 68 69 70 71 72 73 74 |
# File 'lib/vedeu/cursors/move.rb', line 67 def valid_direction? [ :move_down, :move_left, :move_right, :move_up, ].include?(direction) end |