Class: Ramenu::Menus::SimpleBuilder
- Defined in:
- lib/ramenu/menus.rb
Overview
The SimpleBuilder is the default menu builder. It provides basic functionalities to render a menu navigation.
The SimpleBuilder accepts a limited set of options. If you need more flexibility, create a custom Builder and pass the option :builder => BuilderClass to the render_menus
helper method.
Instance Method Summary collapse
Methods inherited from Builder
Constructor Details
This class inherits a constructor from Ramenu::Menus::Builder
Instance Method Details
#render ⇒ Object
90 91 92 93 94 |
# File 'lib/ramenu/menus.rb', line 90 def render @elements.collect do |element| render_element(element) end.join(@options[:separator] || " » ") end |
#render_element(element) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ramenu/menus.rb', line 96 def render_element(element) content = @context.link_to_unless_current(compute_name(element), compute_path(element), element.) # rendering sub-elements if (element.childs.length > 0) content = content + " |" element.childs.each do |child| content = content + @context.link_to_unless_current(compute_name(child), compute_path(child)) + "|" end end if @options[:tag] @context.content_tag(@options[:tag], content) else content end end |