Class: Stannum::Constraints::Types::NilType

Inherits:
Stannum::Constraints::Type show all
Defined in:
lib/stannum/constraints/types/nil_type.rb

Overview

A Nil type constraint asserts that the object is nil.

Constant Summary collapse

NEGATED_TYPE =

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

'stannum.constraints.types.is_nil'
TYPE =

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

'stannum.constraints.types.is_not_nil'

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Stannum::Constraints::Type

#errors_for, #expected_type, #matches?, #negated_errors_for, #with_options

Methods included from Support::Optional

#optional?, #required?, resolve

Methods inherited from Base

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

Constructor Details

#initialize(**options) ⇒ NilType

Returns a new instance of NilType.

Parameters:

  • options (Hash<Symbol, Object>)

    Configuration options for the constraint. Defaults to an empty Hash.



16
17
18
# File 'lib/stannum/constraints/types/nil_type.rb', line 16

def initialize(**options)
  super(::NilClass, **options)
end