Class: Stannum::Constraints::Nothing

Inherits:
Base
  • Object
show all
Defined in:
lib/stannum/constraints/nothing.rb

Overview

An example constraint that does not match any object, even nil.

Examples:

constraint = Stannum::Constraints::Nothing.new
constraint.matches?(Object.new)
#=> false
constraint.does_not_match?(Object.new)
#=> true

Constant Summary collapse

TYPE =

The :type of the error generated for a non-matching object.

'stannum.constraints.anything'

Constants inherited from Base

Base::NEGATED_TYPE

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#==, #clone, #does_not_match?, #dup, #errors_for, #initialize, #match, #message, #negated_errors_for, #negated_match, #negated_message, #negated_type, #type, #with_options

Constructor Details

This class inherits a constructor from Stannum::Constraints::Base

Instance Method Details

#matches?(_actual) ⇒ false Also known as: match?

Returns false for all objects.

Returns:

  • (false)

    in all cases.

See Also:



23
24
25
# File 'lib/stannum/constraints/nothing.rb', line 23

def matches?(_actual)
  false
end