Module: Vedeu::Toggleable::SingletonMethods

Defined in:
lib/vedeu/models/toggleable.rb

Overview

Provide additional behaviour as singleton methods to the including class or module.

Instance Method Summary collapse

Instance Method Details

#buffer(name) ⇒ Vedeu::Buffers::Buffer (private)

Returns the named buffer from the buffer repository.

Parameters:

  • name (NilClass|Symbol|String)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.

Returns:



142
143
144
# File 'lib/vedeu/models/toggleable.rb', line 142

def buffer(name)
  Vedeu.buffers.by_name(name)
end

#cursor_visible?(name) ⇒ Boolean (private)

Returns a boolean indicating whether the cursor is visible.

Parameters:

  • name (NilClass|Symbol|String)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.

Returns:



136
137
138
# File 'lib/vedeu/models/toggleable.rb', line 136

def cursor_visible?(name)
  buffer(name).cursor_visible?
end

#hide(name = Vedeu.focus) ⇒ void Also known as: hide_group, hide_interface

This method returns an undefined value.

Hides the named model, or without a name, the model with same name as the currently focussed interface.

Examples:

Vedeu.hide_group(name)
Vedeu.hide_interface(name)

Parameters:

  • name (NilClass|Symbol|String) (defaults to: Vedeu.focus)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.



58
59
60
# File 'lib/vedeu/models/toggleable.rb', line 58

def hide(name = Vedeu.focus)
  repository.by_name(name).hide
end

#hide_cursor(name = Vedeu.focus) ⇒ void

This method returns an undefined value.

Hide the cursor if visible.

Examples:

Vedeu.hide_cursor(name)

Parameters:

  • name (NilClass|Symbol|String) (defaults to: Vedeu.focus)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.

See Also:



102
103
104
# File 'lib/vedeu/models/toggleable.rb', line 102

def hide_cursor(name = Vedeu.focus)
  hide(name) if cursor_visible?(name)
end

#show(name = Vedeu.focus) ⇒ void Also known as: show_group, show_interface

This method returns an undefined value.

Shows the named model, or without a name, the model with same name as the currently focussed interface.

Examples:

Vedeu.show_group(name)
Vedeu.show_interface(name)

Parameters:

  • name (NilClass|Symbol|String) (defaults to: Vedeu.focus)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.



73
74
75
# File 'lib/vedeu/models/toggleable.rb', line 73

def show(name = Vedeu.focus)
  repository.by_name(name).show
end

#show_cursor(name = Vedeu.focus) ⇒ void

This method returns an undefined value.

Show the cursor if not already visible.

Examples:

Vedeu.show_cursor(name)

Parameters:

  • name (NilClass|Symbol|String) (defaults to: Vedeu.focus)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.

See Also:



114
115
116
# File 'lib/vedeu/models/toggleable.rb', line 114

def show_cursor(name = Vedeu.focus)
  show(name) if cursor_visible?(name)
end

#toggle(name = Vedeu.focus) ⇒ void Also known as: toggle_group, toggle_interface

This method returns an undefined value.

Toggles the visibility of the named model, or without a name, the model with same name as the currently focussed interface.

Examples:

Vedeu.toggle_group(name)
Vedeu.toggle_interface(name)

Parameters:

  • name (NilClass|Symbol|String) (defaults to: Vedeu.focus)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.



88
89
90
# File 'lib/vedeu/models/toggleable.rb', line 88

def toggle(name = Vedeu.focus)
  repository.by_name(name).toggle
end

#toggle_cursor(name = Vedeu.focus) ⇒ void

This method returns an undefined value.

Toggle the cursor visibility.

Examples:

Vedeu.toggle_cursor(name)

Parameters:

  • name (NilClass|Symbol|String) (defaults to: Vedeu.focus)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.

See Also:



126
127
128
# File 'lib/vedeu/models/toggleable.rb', line 126

def toggle_cursor(name = Vedeu.focus)
  toggle(name)
end