Sha256: 45166b5fd4820abea0185bb179adfb27a488323f5af53aad3c4511ba79ee471d
Contents?: true
Size: 827 Bytes
Versions: 2
Compression:
Stored size: 827 Bytes
Contents
# frozen_string_literal: true module Glyptodont module Checkers # Checks that the number of TODOs is below the specified threshold class Counter def initialize(todos:, threshold:) @threshold = threshold @todos = todos end def check message end def passed? count <= threshold end private def count @count ||= todos.size end def message if count.zero? "All done" elsif passed? "#{Glyptodont.pluralize(count, "TODO")}: This is tolerable" else "#{Glyptodont.pluralize(count, "TODO")}: There is work to be done:\n" + todos.map { |t| Glyptodont.format_todo(t) }.join("\n") end end attr_reader :todos, :threshold end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glyptodont-0.3.0 | lib/glyptodont/checkers/counter.rb |
glyptodont-0.2.0 | lib/glyptodont/checkers/counter.rb |