Module: HelpKit::NestedSetHelper

Defined in:
app/helpers/help_kit/nested_set_helper.rb

Instance Method Summary collapse

Instance Method Details

#nested_li(objects, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/help_kit/nested_set_helper.rb', line 3

def nested_li(objects, &block)
  output = "<ul>"
  objects.each do |o|
    output += (:li) {
      concat(capture(o, &block))
      unless o.leaf?
        concat(nested_li(o.children, &block))
      end
    }
  end
  output += "</ul>"
  return output.html_safe
end