Sha256: 43bfac045aeb0769f7a8d20e133b161d2d18df933a5fdffae0ac2f7e31dab10c
Contents?: true
Size: 497 Bytes
Versions: 1
Compression:
Stored size: 497 Bytes
Contents
require 'obst/notes' module Obst class TagsCount def initialize(**opts) @notes = Notes.new(**opts) end def to_s buffer = ["# Tags\n"] @notes.map(&:tags).flatten.tally.sort do |t1, t2| if (compare_count = (t2[1] <=> t1[1])) == 0 t1[0] <=> t2[0] else compare_count end end.each_with_index do |(tag, count), idx| buffer << "#{idx + 1}. #{tag}: #{count}" end buffer.join("\n") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
obst-0.1.10 | lib/obst/tags_count.rb |