Sha256: dca3d6c9f922db6c58196ef6b281db638d5d92bcb5771c8633afddcd1550e3fa
Contents?: true
Size: 423 Bytes
Versions: 10
Compression:
Stored size: 423 Bytes
Contents
module ActsAsTaggableOn 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
10 entries across 9 versions & 4 rubygems