Class: VivlioStarter::CLI::Guards::RelaxedCheck

Inherits:
BaseCheck
  • Object
show all
Defined in:
lib/vivlio_starter/cli/guards/relaxed_check.rb

Overview

任意の Check の :error 違反を :warn に格下げするデコレータ。 コマンド × Check 対応表の「○=推奨」(違反しても停止はせず警告のみ)を表現する。

Instance Method Summary collapse

Constructor Details

#initialize(check) ⇒ RelaxedCheck

Returns a new instance of RelaxedCheck.

Parameters:

  • check (BaseCheck)

    格下げ対象の Check



10
11
12
13
# File 'lib/vivlio_starter/cli/guards/relaxed_check.rb', line 10

def initialize(check)
  @check = check
  super()
end

Instance Method Details

#validateObject



15
16
17
18
19
20
21
# File 'lib/vivlio_starter/cli/guards/relaxed_check.rb', line 15

def validate
  @check.validate.map do |violation|
    next violation unless violation.error?

    violation.with(severity: :warn)
  end
end