Module: Vedeu::Toggleable
- Included in:
- Cursors::Cursor, Groups::Group, Interfaces::Interface
- Defined in:
- lib/vedeu/models/toggleable.rb
Overview
This module provides behaviour for certain classes which can be toggled between being shown and hidden.
Currently using this are: Cursors::Cursor, Groups::Group and Interfaces::Interface.
Defined Under Namespace
Modules: SingletonMethods
Instance Attribute Summary collapse
-
#visible ⇒ Boolean
(also: #visible?)
Whether the toggleable is visible.
Class Method Summary collapse
-
.included(klass) ⇒ Class
Provide additional behaviour to a class or module.
Instance Method Summary collapse
-
#hide ⇒ Boolean
Set the visible state to false and store the model.
-
#show ⇒ Boolean
Set the visible state to true and store the model.
-
#toggle ⇒ Boolean
Toggle the visible state and store the model.
Instance Attribute Details
#visible ⇒ Boolean Also known as: visible?
Returns Whether the toggleable is visible.
15 16 17 |
# File 'lib/vedeu/models/toggleable.rb', line 15 def visible @visible end |
Class Method Details
.included(klass) ⇒ Class
Provide additional behaviour to a class or module.
149 150 151 |
# File 'lib/vedeu/models/toggleable.rb', line 149 def self.included(klass) klass.extend(Vedeu::Toggleable::SingletonMethods) end |
Instance Method Details
#hide ⇒ Boolean
Set the visible state to false and store the model.
21 22 23 24 25 |
# File 'lib/vedeu/models/toggleable.rb', line 21 def hide @visible = false store end |
#show ⇒ Boolean
Set the visible state to true and store the model.
30 31 32 33 34 |
# File 'lib/vedeu/models/toggleable.rb', line 30 def show @visible = true store end |
#toggle ⇒ Boolean
Toggle the visible state and store the model. When the model is hidden, then it is shown, and vice versa.
40 41 42 43 44 |
# File 'lib/vedeu/models/toggleable.rb', line 40 def toggle return hide if visible? show end |