Module: Puffer::Helpers::PufferTreeHelper

Defined in:
lib/puffer/helpers/puffer_tree_helper.rb

Instance Method Summary collapse

Instance Method Details

#puffer_tree(hash, options = {}, &block) ⇒ Object



5
6
7
8
9
# File 'lib/puffer/helpers/puffer_tree_helper.rb', line 5

def puffer_tree hash, options = {}, &block
   :ul, options do
    puffer_tree_node hash, &block
  end if hash.present?
end

#puffer_tree_node(hash, &block) ⇒ Object



11
12
13
14
15
# File 'lib/puffer/helpers/puffer_tree_helper.rb', line 11

def puffer_tree_node hash, &block
  hash.keys.each do |node|
    block.call node, render_tree(hash[node], &block)
  end if hash.present?
end