Class: Vedeu::ToggleCursor

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/cursor/toggle_cursor.rb

Overview

Adjusts the visibility of the cursor.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cursor) ⇒ ToggleCursor

Returns an instance of ToggleCursor.

Parameters:



11
12
13
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 11

def initialize(cursor)
  @cursor = cursor
end

Instance Attribute Details

#cursorObject (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.

Parameters:

Returns:



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.

Parameters:

Returns:



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

#hideCursor

Hides the cursor.

Returns:



38
39
40
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 38

def hide
  cursor.class.new(cursor.attributes.merge!({ state: false })).store
end

#showCursor

Shows the cursor.

Returns:



45
46
47
# File 'lib/vedeu/cursor/toggle_cursor.rb', line 45

def show
  cursor.class.new(cursor.attributes.merge!({ state: true })).store
end