Class: Forematter::Commands::Count
- Inherits:
-
Forematter::CommandRunner
- Object
- Cri::CommandRunner
- Forematter::CommandRunner
- Forematter::Commands::Count
- Defined in:
- lib/forematter/commands/count.rb
Instance Method Summary collapse
Methods inherited from Forematter::CommandRunner
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/forematter/commands/count.rb', line 11 def run counts = .reduce({}) { |a, e| a.merge(e => (a[e] || 0) + 1) } fmt = format(counts) counts.sort_by { |tag, count| count }.each do |tag, count| puts sprintf(fmt, count, tag) end end |