Class: Tagregate::Count

Inherits:
Object
  • Object
show all
Defined in:
lib/tagregate/count.rb

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, io, options) ⇒ Count

Returns a new instance of Count.



3
4
5
6
# File 'lib/tagregate/count.rb', line 3

def initialize(step_mother, io, options)
  @io = io
  @aggregate = {}
end

Instance Method Details

#after_features(whatever) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/tagregate/count.rb', line 15

def after_features(whatever)
  keys = @aggregate.keys.sort

  keys.each do |k|
    @io.puts "#{k.ljust(50, " ")} #{@aggregate[k]}"
  end
end

#after_tags(tags) ⇒ Object



8
9
10
11
12
13
# File 'lib/tagregate/count.rb', line 8

def after_tags(tags)
  tags.tags.each do |tag|
    @aggregate[tag.name] ||= 0
    @aggregate[tag.name] = @aggregate[tag.name] + 1
  end
end