Class: Hackathon::Starter::Navigator
- Inherits:
-
Object
- Object
- Hackathon::Starter::Navigator
- Includes:
- Singleton
- Defined in:
- app/models/hackathon_starter_navigator.rb
Instance Attribute Summary collapse
-
#menu ⇒ Object
Returns the value of attribute menu.
Instance Method Summary collapse
Instance Attribute Details
#menu ⇒ Object
Returns the value of attribute menu.
89 90 91 |
# File 'app/models/hackathon_starter_navigator.rb', line 89 def @menu end |
Instance Method Details
#add(*params) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'app/models/hackathon_starter_navigator.rb', line 90 def add *params position = params.first if params.last.class == Hash path = params.last[:path] label = params.last[:label] else path = params[1] label = params[2] end path ||= '#' @menu ||= MenuItem.new unless position @menu.position ||= position @menu.path ||= path @menu.label ||= label else item = MenuItem.new item.position = position item.path = path item.label = label @menu.add item end end |
#draw ⇒ Object
113 114 115 |
# File 'app/models/hackathon_starter_navigator.rb', line 113 def draw @menu.draw(root: true).html_safe end |