Move font calculation into tag cloud

This commit is contained in:
Katrina Owen 2013-02-28 22:26:57 -05:00
parent 2321d1f2a3
commit d478efdd01
2 changed files with 11 additions and 3 deletions

View file

@ -10,10 +10,20 @@ module Stats
@levels = 10
end
def empty?
tags.empty?
end
def font_size(tag)
(9 + 2*(tag.count.to_i-min)/divisor)
end
def tags
@tags ||= top_tags
end
private
def max
@max ||= tag_counts.max
end
@ -30,8 +40,6 @@ module Stats
@divisor ||= ((max - min) / levels) + 1
end
private
def tag_counts
@tag_counts ||= tags.map {|t| t.count.to_i}
end