Sha256: e5b6c69e5e7a06b787cc1884e7f0819db4cce846132e3053bb273a26866d03c2

Contents?: true

Size: 335 Bytes

Versions: 1

Compression:

Stored size: 335 Bytes

Contents

module TagsHelper
  # See the README for an example using tag_cloud.
  def tag_cloud(tags, classes)
    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

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_20ggable-1.0.0 lib/tags_helper.rb