Class: ActiveMenu::Registry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/active_menu/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

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_nodeObject

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, options={}, &block)
  @main_node.child(id, options, &block)
end

#exists?(id) ⇒ Boolean

Returns:

  • (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


23
24
25
# File 'lib/active_menu/registry.rb', line 23

def menus
  @main_node.children
end

#resetObject



15
16
17
# File 'lib/active_menu/registry.rb', line 15

def reset
  @main_node.leave_children!
end