Sha256: a562133e01dc67856c8be63fada7d7f8fb97cc4a3cdea4c7638033bb973c677f
Contents?: true
Size: 347 Bytes
Versions: 6
Compression:
Stored size: 347 Bytes
Contents
module TagsHelper # See the README for an example using tag_cloud. def tag_cloud(tags, classes) return if tags.all.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
6 entries across 6 versions & 3 rubygems