Class: Contraption::TagCloud
- Inherits:
-
Object
- Object
- Contraption::TagCloud
- Defined in:
- lib/contraption/tag_cloud.rb
Instance Method Summary collapse
-
#initialize(posts) ⇒ TagCloud
constructor
A new instance of TagCloud.
- #to_s ⇒ Object
Constructor Details
#initialize(posts) ⇒ TagCloud
Returns a new instance of TagCloud.
3 4 5 |
# File 'lib/contraption/tag_cloud.rb', line 3 def initialize posts @posts = posts end |
Instance Method Details
#to_s ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/contraption/tag_cloud.rb', line 7 def to_s @posts.by_tag .each_pair .map {|k, v| [tag_link(k), tag_size(v.length)]} .map {|el| scale el} .join "\n" end |