Module: BlogHelper

Defined in:
app/helpers/blog_helper.rb

Instance Method Summary collapse

Instance Method Details

#tag_cloud(tags, classes) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/blog_helper.rb', line 3

def tag_cloud(tags, classes)
  max = tags.sort_by(&:count).last
  tags.alphabetically.each do |tag|
    index = tag.count.to_f / max.count * (classes.size - 1)
    yield(tag, classes[index.round])
  end
end