Class: Evilution::Config::Validators::ExampleTargetingFallback

Inherits:
Base
  • Object
show all
Defined in:
lib/evilution/config/validators/example_targeting_fallback.rb

Constant Summary collapse

FALLBACKS =
%i[full_file unresolved].freeze

Class Method Summary collapse

Class Method Details

.call(value) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/evilution/config/validators/example_targeting_fallback.rb', line 8

def self.call(value)
  unless value.is_a?(String) || value.is_a?(Symbol)
    raise Evilution::ConfigError,
          "example_targeting_fallback must be full_file or unresolved, got #{value.inspect}"
  end

  sym = value.to_sym
  unless FALLBACKS.include?(sym)
    raise Evilution::ConfigError,
          "example_targeting_fallback must be full_file or unresolved, got #{sym.inspect}"
  end

  sym
end