Module: Hashira::CLI::Skip

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

Class Method Summary collapse

Class Method Details

.key(name) ⇒ Object



17
18
19
20
# File 'lib/hashira/cli/skip.rb', line 17

def key(name)
  symbol = name.to_sym
  Pipeline::ANALYZERS.include?(symbol) ? symbol : unknown(name)
end

.parse(list) ⇒ Object

Raises:



8
9
10
11
12
13
14
15
# File 'lib/hashira/cli/skip.rb', line 8

def parse(list)
  return [] unless list

  keys = list.split(",").map { key(it.strip) }
  raise Error, "cannot skip every analyzer" if (Pipeline::ANALYZERS - keys).empty?

  keys
end

.unknown(name) ⇒ Object

Raises:



22
23
24
# File 'lib/hashira/cli/skip.rb', line 22

def unknown(name)
  raise Error, "unknown --skip #{name.inspect} (use: #{Pipeline::ANALYZERS.join(", ")})"
end