Module: Kind::Validator

Defined in:
lib/kind/validator.rb

Defined Under Namespace

Classes: InvalidDefaultStrategy, InvalidDefinition

Constant Summary collapse

DEFAULT_STRATEGIES =
::Set.new(%w[instance_of kind_of]).freeze

Class Method Summary collapse

Class Method Details

.default_strategyObject



30
31
32
# File 'lib/kind/validator.rb', line 30

def self.default_strategy
  @default_strategy ||= :kind_of
end

.default_strategy=(option) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/kind/validator.rb', line 34

def self.default_strategy=(option)
  if DEFAULT_STRATEGIES.member?(String(option))
    @default_strategy = option.to_sym
  else
    raise InvalidDefaultStrategy.new(option)
  end
end