Class: Gbc::Trestle::MenuHelper
- Inherits:
-
Object
- Object
- Gbc::Trestle::MenuHelper
- Defined in:
- lib/gbc/trestle/menu_helper.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#group ⇒ Object
Returns the value of attribute group.
-
#item ⇒ Object
Returns the value of attribute item.
Instance Method Summary collapse
-
#initialize(base, group, item) ⇒ MenuHelper
constructor
A new instance of MenuHelper.
- #render_menu ⇒ Object
Constructor Details
#initialize(base, group, item) ⇒ MenuHelper
Returns a new instance of MenuHelper.
4 5 6 7 8 |
# File 'lib/gbc/trestle/menu_helper.rb', line 4 def initialize(base, group, item) @base = base @group = group @item = item end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
10 11 12 |
# File 'lib/gbc/trestle/menu_helper.rb', line 10 def base @base end |
#group ⇒ Object
Returns the value of attribute group.
10 11 12 |
# File 'lib/gbc/trestle/menu_helper.rb', line 10 def group @group end |
#item ⇒ Object
Returns the value of attribute item.
10 11 12 |
# File 'lib/gbc/trestle/menu_helper.rb', line 10 def item @item end |
Instance Method Details
#render_menu ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gbc/trestle/menu_helper.rb', line 12 def config = load_config group_obj = config[group] item_obj = group_obj["items"][item] base.item( item, item_obj["url"], priority: item_priority(group_obj, item_obj), label: safe(item_obj["label"]), icon: icon(item_obj), target: target(item_obj), badge: badge(item_obj), group: safe(group_obj["label"]) ) end |