Sha256: d981f8e9849dc302dec8aa0ddfe80f9daf4aaf74f53a4febf77613b340da3785

Contents?: true

Size: 663 Bytes

Versions: 11

Compression:

Stored size: 663 Bytes

Contents

module Wally
  class CountsTags
    def initialize lists_features
      @lists_features = lists_features
    end

    def count_tags
      @lists_features.features.inject(Hash.new(0)) do |tag_count, feature|
        if feature["tags"]
          feature["tags"].each do |tag|
            tag_count[tag["name"].downcase] += 1
          end
        end
        if feature["elements"]
          feature["elements"].each do |element|
            if element["tags"]
              element["tags"].each do |tag|
                tag_count[tag["name"].downcase] += 1
              end
            end
          end
        end
        tag_count
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
wally-0.0.29 lib/wally/counts_tags.rb
wally-0.0.28 lib/wally/counts_tags.rb
wally-0.0.27 lib/wally/counts_tags.rb
wally-0.0.26 lib/wally/counts_tags.rb
wally-0.0.25 lib/wally/counts_tags.rb
wally-0.0.24 lib/wally/counts_tags.rb
wally-0.0.22 lib/wally/counts_tags.rb
wally-0.0.21 lib/wally/counts_tags.rb
wally-0.0.20 lib/wally/counts_tags.rb
wally-0.0.19 lib/wally/counts_tags.rb
wally-0.0.18 lib/wally/counts_tags.rb