Module: ActiveTools::ActionPack::ActionView::PerformAsTree

Defined in:
lib/active_tools/action_pack/action_view/perform_as_tree.rb

Class Method Summary collapse

Class Method Details

.line(item, children_method, depth = 0) {|item, depth| ... } ⇒ Object

Yields:

  • (item, depth)


5
6
7
8
9
10
# File 'lib/active_tools/action_pack/action_view/perform_as_tree.rb', line 5

def self.line(item, children_method, depth = 0, &block)
  yield item, depth
  item.send(children_method).each do |child|
    line(child, children_method, depth+1, &block)
  end
end