class Clausewitz::Spelling::LangResults

Public Class Methods

new(lang, entry_results) click to toggle source
# File lib/clausewitz/spelling/results.rb, line 47
def initialize(lang, entry_results)
  @lang          = lang
  @entry_results = entry_results
end

Public Instance Methods

failed?() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 60
def failed?
  @entry_results.any?(&:failed?)
end
failures() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 64
def failures
  @entry_results.select(&:failed?)
end
ignored() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 56
def ignored
  @entry_results.select(&:ignored?)
end
ignored?() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 52
def ignored?
  false
end
size() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 68
def size
  @entry_results.size
end
to_s() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 72
def to_s
  to_str
end
to_str(indent = 0) click to toggle source
# File lib/clausewitz/spelling/results.rb, line 76
def to_str(indent = 0)
  firstspacer = ' ' * indent
  spacer = ' ' * (indent + 2)
  failures = @entry_results.select(&:failed?)
  outlines = failures.map { |e| "#{spacer}#{e.to_str(indent + 2)}" }
  outlines = outlines.join("\n")
  outlang = failed? ? "#{@lang} has #{failures.size} keys with errors (#{size} keys checked, #{ignored.size} ignored)".red : "#{@lang} passed (#{size} keys checked, #{ignored.size} ignored)".green
  out = "#{firstspacer}#{outlang}\n#{outlines}"
end