Module: ActsAsTaggableOn::TagsHelper
- Defined in:
- lib/acts-as-taggable-on/tags_helper.rb
Instance Method Summary collapse
-
#tag_cloud(tags, classes) ⇒ Object
See the wiki for an example using tag_cloud.
Instance Method Details
#tag_cloud(tags, classes) ⇒ Object
See the wiki for an example using tag_cloud.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/acts-as-taggable-on/tags_helper.rb', line 6 def tag_cloud(, classes) return [] if .empty? max_count = .max_by(&:taggings_count).taggings_count.to_f .each do |tag| index = ((tag.taggings_count / max_count) * (classes.size - 1)) yield tag, classes[index.nan? ? 0 : index.round] end end |