Sha256: a93b6466bffbd272910d02fc18aaa15159744c04164a9fd9278d8726ac4063c3
Contents?: true
Size: 374 Bytes
Versions: 15
Compression:
Stored size: 374 Bytes
Contents
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
Version data entries
15 entries across 15 versions & 3 rubygems