Sha256: 7d9ecf9b3c1bc2b7af4eaa92805d084f85ff6f034b243628bc34488153fc8f43
Contents?: true
Size: 415 Bytes
Versions: 35
Compression:
Stored size: 415 Bytes
Contents
module Tagtical module TagsHelper # See the README for an example using tag_cloud. def tag_cloud(tags, classes) tags = tags.all if tags.respond_to?(:all) return [] if tags.empty? max_count = tags.sort_by(&:count).last.count.to_f tags.each do |tag| index = ((tag.count / max_count) * (classes.size - 1)).round yield tag, classes[index] end end end end
Version data entries
35 entries across 35 versions & 1 rubygems