Module: Hashira::CLI::FailOn

Defined in:
lib/hashira/cli/fail_on.rb

Constant Summary collapse

KINDS =
{
  "cycles" => "cycle", "cycle" => "cycle",
  "sdp" => "sdp_violation", "sdp_violation" => "sdp_violation"
}.freeze

Class Method Summary collapse

Class Method Details

.kind(name) ⇒ Object



19
20
21
22
23
# File 'lib/hashira/cli/fail_on.rb', line 19

def kind(name)
  KINDS.fetch(name) do
    raise Error, "unknown --fail-on kind #{name.inspect} (use: #{KINDS.keys.join(", ")})"
  end
end

.parse(list) ⇒ Object



13
14
15
16
17
# File 'lib/hashira/cli/fail_on.rb', line 13

def parse(list)
  return [] unless list

  list.split(",").map { kind(_1.strip) }.uniq
end