class Recog::MatchReporter
Attributes
fail_count[R]
formatter[R]
line_count[R]
match_count[R]
Public Class Methods
new(options, formatter)
click to toggle source
# File lib/recog/match_reporter.rb, line 6 def initialize(options, formatter) @options = options @formatter = formatter reset_counts end
Public Instance Methods
failure(text)
click to toggle source
# File lib/recog/match_reporter.rb, line 32 def failure(text) @fail_count += 1 formatter.failure_message(text) end
increment_line_count()
click to toggle source
# File lib/recog/match_reporter.rb, line 23 def increment_line_count @line_count += 1 end
match(text)
click to toggle source
# File lib/recog/match_reporter.rb, line 27 def match(text) @match_count += 1 formatter.success_message(text) end
print_summary()
click to toggle source
# File lib/recog/match_reporter.rb, line 37 def print_summary colorize_summary(summary_line) end
report() { |self| ... }
click to toggle source
# File lib/recog/match_reporter.rb, line 12 def report reset_counts yield self summarize unless @options.quiet end
stop?()
click to toggle source
# File lib/recog/match_reporter.rb, line 18 def stop? return false unless @options.fail_fast @fail_count >= @options.stop_after end
Private Instance Methods
colorize_summary(summary)
click to toggle source
# File lib/recog/match_reporter.rb, line 69 def colorize_summary(summary) if @fail_count > 0 formatter.failure_message(summary) else formatter.success_message(summary) end end
detail?()
click to toggle source
# File lib/recog/match_reporter.rb, line 47 def detail? @options.detail end
print_lines_processed()
click to toggle source
# File lib/recog/match_reporter.rb, line 58 def print_lines_processed formatter.status_message("\nProcessed #{line_count} lines") end
reset_counts()
click to toggle source
# File lib/recog/match_reporter.rb, line 43 def reset_counts @line_count = @match_count = @fail_count = 0 end
summarize()
click to toggle source
# File lib/recog/match_reporter.rb, line 51 def summarize if detail? print_lines_processed print_summary end end
summary_line()
click to toggle source
# File lib/recog/match_reporter.rb, line 62 def summary_line summary = "SUMMARY: " summary << "#{match_count} matches" summary << " and #{fail_count} failures" summary end