Class: T::Private::Types::TypeAlias
- Inherits:
-
Types::Base
- Object
- Types::Base
- T::Private::Types::TypeAlias
- Defined in:
- lib/types/private/types/type_alias.rb
Overview
Wraps a proc for a type alias to defer its evaluation.
Instance Method Summary collapse
- #aliased_type ⇒ Object
-
#initialize(callable) ⇒ TypeAlias
constructor
A new instance of TypeAlias.
-
#name ⇒ Object
overrides Base.
-
#recursively_valid?(obj) ⇒ Boolean
overrides Base.
-
#valid?(obj) ⇒ Boolean
overrides Base.
Methods inherited from Types::Base
#==, #describe_obj, #error_message_for_obj, #error_message_for_obj_recursive, #hash, method_added, #subtype_of?, #to_s, #validate!
Constructor Details
#initialize(callable) ⇒ TypeAlias
Returns a new instance of TypeAlias.
8 9 10 |
# File 'lib/types/private/types/type_alias.rb', line 8 def initialize(callable) @callable = callable end |
Instance Method Details
#aliased_type ⇒ Object
12 13 14 |
# File 'lib/types/private/types/type_alias.rb', line 12 def aliased_type @aliased_type ||= T::Utils.coerce(@callable.call) end |
#name ⇒ Object
overrides Base
17 18 19 |
# File 'lib/types/private/types/type_alias.rb', line 17 def name aliased_type.name end |
#recursively_valid?(obj) ⇒ Boolean
overrides Base
22 23 24 |
# File 'lib/types/private/types/type_alias.rb', line 22 def recursively_valid?(obj) aliased_type.recursively_valid?(obj) end |
#valid?(obj) ⇒ Boolean
overrides Base
27 28 29 |
# File 'lib/types/private/types/type_alias.rb', line 27 def valid?(obj) aliased_type.valid?(obj) end |