Class: ActiveMenu::Registry
- Inherits:
-
Object
- Object
- ActiveMenu::Registry
- Includes:
- Singleton
- Defined in:
- lib/active_menu/registry.rb
Instance Attribute Summary collapse
-
#main_node ⇒ Object
Returns the value of attribute main_node.
Instance Method Summary collapse
- #create(id, options = {}, &block) ⇒ Object
- #exists?(id) ⇒ Boolean
- #get(id, &block) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #menus ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
7 8 9 |
# File 'lib/active_menu/registry.rb', line 7 def initialize @main_node = ActiveMenu::Menu.new(:main_node) end |
Instance Attribute Details
#main_node ⇒ Object
Returns the value of attribute main_node.
5 6 7 |
# File 'lib/active_menu/registry.rb', line 5 def main_node @main_node end |
Instance Method Details
#create(id, options = {}, &block) ⇒ Object
11 12 13 |
# File 'lib/active_menu/registry.rb', line 11 def create(id, ={}, &block) @main_node.child(id, , &block) end |
#exists?(id) ⇒ Boolean
27 28 29 |
# File 'lib/active_menu/registry.rb', line 27 def exists?(id) @main_node.exists?(id) end |
#get(id, &block) ⇒ Object
19 20 21 |
# File 'lib/active_menu/registry.rb', line 19 def get(id, &block) @main_node.get(id, &block) end |
#menus ⇒ Object
23 24 25 |
# File 'lib/active_menu/registry.rb', line 23 def @main_node.children end |
#reset ⇒ Object
15 16 17 |
# File 'lib/active_menu/registry.rb', line 15 def reset @main_node.leave_children! end |