Module: Valligator::Helper

Defined in:
lib/valligator_helper.rb

Instance Method Summary collapse

Instance Method Details

#valligate(*testees, names: nil) ⇒ Valligator Also known as: v

Returns a new Valligator instance

Parameters:

  • testees (Array<Object>)

    One or more objects to be tested

  • option (Array<String>)

    :names Testee names

Returns:



10
11
12
# File 'lib/valligator_helper.rb', line 10

def valligate(*testees, names: nil)
  Valligator.new(*testees, names: names)
end

#vh(hash) ⇒ Valligator

Returns a new Valligator instance created from a hash, where hash values are testees and hash keys are their names.

Parameters:

  • hash (Hash)

Returns:



21
22
23
# File 'lib/valligator_helper.rb', line 21

def vh(hash)
  Valligator.new(*hash.values, names: hash.keys)
end