Sha256: c54ee8ead43389d89f02375ff9f06f1e833556668779f357780359761c863ac9

Contents?: true

Size: 415 Bytes

Versions: 2

Compression:

Stored size: 415 Bytes

Contents

module Puffer
  module Helpers
    module PufferTreeHelper

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

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

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puffer-0.1.1 lib/puffer/helpers/puffer_tree_helper.rb
puffer-0.1.0 lib/puffer/helpers/puffer_tree_helper.rb