Class: Admix::Navigation::NavBar
- Inherits:
-
Object
- Object
- Admix::Navigation::NavBar
- Defined in:
- lib/admix/navigation/navbar.rb
Constant Summary collapse
Array.new
Array.new
Class Method Summary collapse
- .add(*menus) ⇒ Object
- .add_menu(menu) ⇒ Object
- .all ⇒ Object
- .clear! ⇒ Object
- .deeply_find(key, menu) ⇒ Object
- .find(key) ⇒ Object
- .insert_post_menus ⇒ Object
- .post_menu(&block) ⇒ Object
Class Method Details
.add(*menus) ⇒ Object
27 28 29 30 31 |
# File 'lib/admix/navigation/navbar.rb', line 27 def self.add(*) .each do || self. end end |
.add_menu(menu) ⇒ Object
33 34 35 36 37 |
# File 'lib/admix/navigation/navbar.rb', line 33 def self.() if .is_a? Admix::Navigation::Menu @@menus << end end |
.all ⇒ Object
69 70 71 |
# File 'lib/admix/navigation/navbar.rb', line 69 def self.all @@menus end |
.clear! ⇒ Object
73 74 75 76 |
# File 'lib/admix/navigation/navbar.rb', line 73 def self.clear! @@menus = [] @@menus_procs = [] end |
.deeply_find(key, menu) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/admix/navigation/navbar.rb', line 53 def self.deeply_find(key, ) return false if .children.length == 0 i = 0 while i < .children.length do = .children[i] self.deeply_find(key, ) return if .key == key i += 1 end false end |
.find(key) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/admix/navigation/navbar.rb', line 39 def self.find(key) @@menus.each do || = self.deeply_find(key, ) if yield return elsif .key == key yield return end end end |
.insert_post_menus ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/admix/navigation/navbar.rb', line 16 def self. Rails.application.railties.engines.select do |e| if e.respond_to?(:navigation) e. end end @@menus_procs.each do |proc| proc.call() end end |
.post_menu(&block) ⇒ Object
12 13 14 |
# File 'lib/admix/navigation/navbar.rb', line 12 def self.(&block) @@menus_procs << block end |