Class: Vedeu::ToggleCursor
- Inherits:
-
Object
- Object
- Vedeu::ToggleCursor
- Defined in:
- lib/vedeu/cursor/toggle_cursor.rb
Overview
Adjusts the visibility of the cursor.
Instance Attribute Summary collapse
-
#cursor ⇒ Object
readonly
private
Returns the value of attribute cursor.
Class Method Summary collapse
-
.hide(cursor) ⇒ Cursor
Hides the cursor.
-
.show(cursor) ⇒ Cursor
Shows the cursor.
Instance Method Summary collapse
-
#hide ⇒ Cursor
Hides the cursor.
-
#initialize(cursor) ⇒ ToggleCursor
constructor
Returns an instance of ToggleCursor.
-
#show ⇒ Cursor
Shows the cursor.
Constructor Details
#initialize(cursor) ⇒ ToggleCursor
Returns an instance of ToggleCursor.
11 12 13 |
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 11 def initialize(cursor) @cursor = cursor end |
Instance Attribute Details
#cursor ⇒ Object (readonly, private)
Returns the value of attribute cursor.
51 52 53 |
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 51 def cursor @cursor end |
Class Method Details
.hide(cursor) ⇒ Cursor
Hides the cursor.
19 20 21 22 23 |
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 19 def self.hide(cursor) return cursor if cursor.invisible? new(cursor).hide end |
.show(cursor) ⇒ Cursor
Shows the cursor.
29 30 31 32 33 |
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 29 def self.show(cursor) return cursor if cursor.visible? new(cursor).show end |
Instance Method Details
#hide ⇒ Cursor
Hides the cursor.
38 39 40 |
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 38 def hide cursor.class.new(cursor.attributes.merge!({ state: false })).store end |
#show ⇒ Cursor
Shows the cursor.
45 46 47 |
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 45 def show cursor.class.new(cursor.attributes.merge!({ state: true })).store end |