Class: Stannum::Constraints::Anything

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

Overview

An example constraint that matches any object, even nil.

Examples:

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

Constant Summary collapse

NEGATED_TYPE =

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

'stannum.constraints.anything'

Constants inherited from Base

Base::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) ⇒ true Also known as: match?

Returns true for all objects.

Returns:

  • (true)

    in all cases.

See Also:



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

def matches?(_actual)
  true
end