class SpellCheck::Report
Attributes
errata[R]
Public Class Methods
new()
click to toggle source
# File lib/spellcheck/report.rb, line 5 def initialize @errata = [] end
Public Instance Methods
accept?()
click to toggle source
# File lib/spellcheck/report.rb, line 13 def accept? status == 'Accept' end
reject?()
click to toggle source
# File lib/spellcheck/report.rb, line 17 def reject? !accept? end
status()
click to toggle source
# File lib/spellcheck/report.rb, line 21 def status typo_count.zero? ? 'Accept' : 'Reject' end
to_s()
click to toggle source
# File lib/spellcheck/report.rb, line 25 def to_s [ results, conclusions ].join("\n\n") end
typo_count()
click to toggle source
# File lib/spellcheck/report.rb, line 9 def typo_count @errata.size end
Private Instance Methods
conclusions()
click to toggle source
# File lib/spellcheck/report.rb, line 48 def conclusions ColorString.red("result: #{typo_count} typo found.") end
results()
click to toggle source
# File lib/spellcheck/report.rb, line 34 def results header = %w(Location Text Pattern Expected) rows = errata.map do |typo| [ typo.line_number, typo.place, ColorString.red(typo.pattern), ColorString.green(typo.expected) ] end Terminal::Table.new(headings: header, rows: rows) end