Class: T::Types::TypedSet
- Inherits:
-
TypedEnumerable
- Object
- Base
- TypedEnumerable
- T::Types::TypedSet
- Defined in:
- lib/types/types/typed_set.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Untyped
Instance Method Summary collapse
-
#name ⇒ Object
overrides Base.
- #new ⇒ Object
-
#recursively_valid?(obj) ⇒ Boolean
overrides Base.
-
#underlying_class ⇒ Object
We can reference ‘Set` directly without a load guard: as of Ruby 3.2 it ships as a default-autoloaded constant (Ruby registers `autoload :Set, “set”`), so the first reference here transparently loads it.
-
#valid?(obj) ⇒ Boolean
overrides Base.
Methods inherited from TypedEnumerable
#build_type, #describe_obj, #initialize, #type
Methods inherited from Base
#==, #describe_obj, #error_message_for_obj, #error_message_for_obj_recursive, #hash, method_added, #subtype_of?, #to_s, #validate!
Constructor Details
This class inherits a constructor from T::Types::TypedEnumerable
Instance Method Details
#name ⇒ Object
overrides Base
16 17 18 |
# File 'lib/types/types/typed_set.rb', line 16 def name "T::Set[#{type.name}]" end |
#new ⇒ Object
30 31 32 |
# File 'lib/types/types/typed_set.rb', line 30 def new(...) Set.new(...) end |
#recursively_valid?(obj) ⇒ Boolean
overrides Base
21 22 23 |
# File 'lib/types/types/typed_set.rb', line 21 def recursively_valid?(obj) obj.is_a?(Set) && super end |
#underlying_class ⇒ Object
We can reference ‘Set` directly without a load guard: as of Ruby 3.2 it ships as a default-autoloaded constant (Ruby registers `autoload :Set, “set”`), so the first reference here transparently loads it. Ruby 3.3 – the most recently supported release – keeps this behavior, and Ruby 3.1 and earlier (which required an explicit `require “set”`) are past EOL.
11 12 13 |
# File 'lib/types/types/typed_set.rb', line 11 def Set end |