Module: TagsHelper
- Defined in:
- lib/acts_as_taggable_on/tags_helper.rb
Instance Method Summary collapse
-
#tag_cloud(tags, classes) ⇒ Object
See the README for an example using tag_cloud.
Instance Method Details
#tag_cloud(tags, classes) ⇒ Object
See the README for an example using tag_cloud.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/acts_as_taggable_on/tags_helper.rb', line 3 def tag_cloud(, classes) return [] if .empty? max_count = .sort_by(&:count).last.count.to_f .each do |tag| index = ((tag.count / max_count) * (classes.size - 1)).round yield tag, classes[index] end end |