Module: Vedeu::Toggleable::ClassMethods

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

Overview

Provide class methods to models to allow the visibility to be changed.

Instance Method Summary collapse

Instance Method Details

#hide(name = nil) ⇒ void Also known as: hide_cursor, hide_group, hide_interface

This method returns an undefined value.

Hides the model.

Parameters:

  • name (String) (defaults to: nil)


56
57
58
# File 'lib/vedeu/models/toggleable.rb', line 56

def hide(name = nil)
  model_by_name(repository, name).hide
end

#model_by_name(klass, name = nil) ⇒ void (private)

This method returns an undefined value.

Fetch the model by name.

Parameters:

  • name (String) (defaults to: nil)
  • klass (void)

    The repository of the model.



92
93
94
# File 'lib/vedeu/models/toggleable.rb', line 92

def model_by_name(klass, name = nil)
  klass.by_name(name || Vedeu.focus)
end

#show(name = nil) ⇒ void Also known as: show_cursor, show_group, show_interface

This method returns an undefined value.

Shows the model.

Parameters:

  • name (String) (defaults to: nil)


67
68
69
# File 'lib/vedeu/models/toggleable.rb', line 67

def show(name = nil)
  model_by_name(repository, name).show
end

#toggle(name = nil) ⇒ void Also known as: toggle_cursor, toggle_group, toggle_interface

This method returns an undefined value.

Toggles the visibility of the model.

Parameters:

  • name (String) (defaults to: nil)


78
79
80
# File 'lib/vedeu/models/toggleable.rb', line 78

def toggle(name = nil)
  model_by_name(repository, name).toggle
end