lib/nanoc/toolbox/helpers/tagging_extra.rb
# Count the tags in a given collection of items. By default, the method
# counts tags in all the site items. The result is an hash such as:
# { tag => count }.
#
# @param [Array<Nanoc::Item>] items
# @return [Hash] Hash indexed by tag name with the occurences as value
Count the tags in a given collection of items. By default, the method
counts tags in all the site items. The result is an hash such as:
{ tag => count }.
Count the tags in a given collection of items . By default the method counts tags in all the site items . The result is an hash such as : { tag = > count } .
def count_tags(items=nil)
      items ||= @items
      tags = items.map { |i| i[:tags] }.flatten.delete_if{|t| t.nil?}
      tags.inject(Hash.new(0)) {|h,i| h[i] += 1; h }
    end
def count_tags ( items = nil ) items ||= @items tags = items . map { | i | i [ :tags ] } . flatten . delete_if { | t | t . nil? } tags . inject ( Hash . new ( 0 ) ) { | h , i | h [ i ] += 1 ; h } end
Count the tags in a given collection of items.
Count the tags in a given collection of items .
Hash indexed by tag name with the occurences as value
Hash indexed by tag name with the occurences as value
Hash
items
None