Class: T::Private::Types::Void

Inherits:
Types::Base show all
Defined in:
lib/types/private/types/void.rb

Overview

A marking class for when methods return void. Should never appear in types directly.

Constant Summary collapse

ERROR_MESSAGE =
"Validation is being done on an `Void`. Please report to #dev-productivity."
VOID =

The actual return value of ‘.void` methods.

Uses ‘Module.new` because in Ruby an anonymous module will inherit the name of the constant it’s assigned to. This gives it a readable name someone examines it in Pry or with ‘#inspect` like:

T::Private::Types::Void::VOID
Module.new.freeze

Instance Method Summary collapse

Methods inherited from Types::Base

#==, #describe_obj, #error_message_for_obj, #hash, method_added, #subtype_of?, #to_s, #validate!

Instance Method Details

#nameObject



20
21
22
# File 'lib/types/private/types/void.rb', line 20

def name
  "<VOID>"
end

#valid?(obj) ⇒ Boolean

Returns:

Raises:



25
26
27
# File 'lib/types/private/types/void.rb', line 25

def valid?(obj)
  raise ERROR_MESSAGE
end