Class: SimpleCov::ExitCodes::Check

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov/exit_codes/check.rb

Overview

Shared skeleton for the threshold checks: stash the result and the threshold configuration, fail when any violation exists, and report one message per violation. Subclasses supply exit_code, compute_violations (memoized here — failing? and report both consult it), and report_violation.

Instance Method Summary collapse

Constructor Details

#initialize(result, thresholds) ⇒ Check

Returns a new instance of Check.



11
12
13
14
# File 'lib/simplecov/exit_codes/check.rb', line 11

def initialize(result, thresholds)
  @result = result
  @thresholds = thresholds
end

Instance Method Details

#failing?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/simplecov/exit_codes/check.rb', line 16

def failing?
  violations.any?
end

#reportObject



20
21
22
# File 'lib/simplecov/exit_codes/check.rb', line 20

def report
  violations.each { |violation| report_violation(violation) }
end