Module: Strict::Dsl::Validatable

Included in:
Attributes::Dsl, Methods::Dsl
Defined in:
lib/strict/dsl/validatable.rb

Instance Method Summary collapse

Instance Method Details

#AllOf(*subvalidators) ⇒ Object

rubocop:disable Naming/MethodName



8
# File 'lib/strict/dsl/validatable.rb', line 8

def AllOf(*subvalidators) = ::Strict::Validators::AllOf.new(*subvalidators)

#AnyOf(*subvalidators) ⇒ Object



9
# File 'lib/strict/dsl/validatable.rb', line 9

def AnyOf(*subvalidators) = ::Strict::Validators::AnyOf.new(*subvalidators)

#AnythingObject



10
# File 'lib/strict/dsl/validatable.rb', line 10

def Anything = ::Strict::Validators::Anything.instance

#ArrayOf(element_validator) ⇒ Object



11
# File 'lib/strict/dsl/validatable.rb', line 11

def ArrayOf(element_validator) = ::Strict::Validators::ArrayOf.new(element_validator)

#BooleanObject



12
# File 'lib/strict/dsl/validatable.rb', line 12

def Boolean = ::Strict::Validators::Boolean.instance

#HashOf(key_validator_to_value_validator) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/strict/dsl/validatable.rb', line 14

def HashOf(key_validator_to_value_validator)
  if key_validator_to_value_validator.size != 1
    raise ArgumentError, "HashOf's usage is: HashOf(KeyValidator => ValueValidator)"
  end

  key_validator, value_validator = key_validator_to_value_validator.first
  ::Strict::Validators::HashOf.new(key_validator, value_validator)
end

#RangeOf(element_validator) ⇒ Object



23
# File 'lib/strict/dsl/validatable.rb', line 23

def RangeOf(element_validator) = ::Strict::Validators::RangeOf.new(element_validator)