Module: Vedeu::Focus Private
- Extended by:
- Focus
- Includes:
- Common, Repository
- Included in:
- Focus
- Defined in:
- lib/vedeu/repositories/focus.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
The Focus repository is simply a collection of interface names, this module serving to store and manipulate the which interface is currently being focussed.
Class Method Summary collapse
-
.add(attributes) ⇒ Array
private
Add an interface name to the focus list unless it is already registered.
-
.by_name(name) ⇒ String
private
Focus an interface by name.
-
.current ⇒ String
private
Return the interface currently focussed.
-
.current?(name) ⇒ Boolean
private
Returns a boolean indicating whether the named interface is focussed.
-
.in_memory ⇒ Array
private
private
Returns an empty collection ready for the storing of interface names.
-
.next_item ⇒ String
private
Put the next interface relative to the current interfaces in focus.
-
.prev_item ⇒ String
private
Put the previous interface relative to the current interface in focus.
-
.registered ⇒ Array
private
Returns all registered interfaces by name.
-
.registered?(name) ⇒ Boolean
private
Returns a boolean indicating whether the named interface is registered.
Instance Method Summary collapse
-
#add(attributes) ⇒ Array
private
Add an interface name to the focus list unless it is already registered.
-
#by_name(name) ⇒ String
private
Focus an interface by name.
-
#current ⇒ String
private
Return the interface currently focussed.
-
#current?(name) ⇒ Boolean
private
Returns a boolean indicating whether the named interface is focussed.
-
#in_memory ⇒ Array
private
private
Returns an empty collection ready for the storing of interface names.
-
#next_item ⇒ String
private
Put the next interface relative to the current interfaces in focus.
-
#prev_item ⇒ String
private
Put the previous interface relative to the current interface in focus.
-
#registered ⇒ Array
private
Returns all registered interfaces by name.
-
#registered?(name) ⇒ Boolean
private
Returns a boolean indicating whether the named interface is registered.
Methods included from Repository
#all, #find, #missing_required, #reset, #storage, #validate_attributes!
Methods included from Common
Class Method Details
.add(attributes) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add an interface name to the focus list unless it is already registered.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vedeu/repositories/focus.rb', line 36 def add(attributes) validate_attributes!(attributes) if registered?(attributes[:name]) storage else storage << attributes[:name] end end |
.by_name(name) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Focus an interface by name.
53 54 55 56 57 58 59 60 61 |
# File 'lib/vedeu/repositories/focus.rb', line 53 def by_name(name) fail InterfaceNotFound unless storage.include?(name) storage.rotate!(storage.index(name)) Vedeu.log("Interface in focus: '#{current}'") current end |
.current ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the interface currently focussed.
68 69 70 71 72 |
# File 'lib/vedeu/repositories/focus.rb', line 68 def current fail NoInterfacesDefined if storage.empty? storage.first end |
.current?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether the named interface is focussed.
78 79 80 |
# File 'lib/vedeu/repositories/focus.rb', line 78 def current?(name) current == name end |
.in_memory ⇒ Array (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns an empty collection ready for the storing of interface names.
127 128 129 |
# File 'lib/vedeu/repositories/focus.rb', line 127 def in_memory [] end |
.next_item ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Put the next interface relative to the current interfaces in focus.
85 86 87 88 89 90 91 |
# File 'lib/vedeu/repositories/focus.rb', line 85 def next_item storage.rotate! Vedeu.log("Interface in focus: '#{current}'") current end |
.prev_item ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Put the previous interface relative to the current interface in focus.
96 97 98 99 100 101 102 |
# File 'lib/vedeu/repositories/focus.rb', line 96 def prev_item storage.rotate!(-1) Vedeu.log("Interface in focus: '#{current}'") current end |
.registered ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns all registered interfaces by name.
107 108 109 |
# File 'lib/vedeu/repositories/focus.rb', line 107 def registered storage end |
.registered?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether the named interface is registered.
115 116 117 118 119 |
# File 'lib/vedeu/repositories/focus.rb', line 115 def registered?(name) return false if storage.empty? storage.include?(name) end |
Instance Method Details
#add(attributes) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add an interface name to the focus list unless it is already registered.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vedeu/repositories/focus.rb', line 36 def add(attributes) validate_attributes!(attributes) if registered?(attributes[:name]) storage else storage << attributes[:name] end end |
#by_name(name) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Focus an interface by name.
53 54 55 56 57 58 59 60 61 |
# File 'lib/vedeu/repositories/focus.rb', line 53 def by_name(name) fail InterfaceNotFound unless storage.include?(name) storage.rotate!(storage.index(name)) Vedeu.log("Interface in focus: '#{current}'") current end |
#current ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the interface currently focussed.
68 69 70 71 72 |
# File 'lib/vedeu/repositories/focus.rb', line 68 def current fail NoInterfacesDefined if storage.empty? storage.first end |
#current?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether the named interface is focussed.
78 79 80 |
# File 'lib/vedeu/repositories/focus.rb', line 78 def current?(name) current == name end |
#in_memory ⇒ Array (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns an empty collection ready for the storing of interface names.
127 128 129 |
# File 'lib/vedeu/repositories/focus.rb', line 127 def in_memory [] end |
#next_item ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Put the next interface relative to the current interfaces in focus.
85 86 87 88 89 90 91 |
# File 'lib/vedeu/repositories/focus.rb', line 85 def next_item storage.rotate! Vedeu.log("Interface in focus: '#{current}'") current end |
#prev_item ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Put the previous interface relative to the current interface in focus.
96 97 98 99 100 101 102 |
# File 'lib/vedeu/repositories/focus.rb', line 96 def prev_item storage.rotate!(-1) Vedeu.log("Interface in focus: '#{current}'") current end |
#registered ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns all registered interfaces by name.
107 108 109 |
# File 'lib/vedeu/repositories/focus.rb', line 107 def registered storage end |
#registered?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether the named interface is registered.
115 116 117 118 119 |
# File 'lib/vedeu/repositories/focus.rb', line 115 def registered?(name) return false if storage.empty? storage.include?(name) end |