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
-
#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
11 12 13 |
# File 'lib/types/types/typed_set.rb', line 11 def name "T::Set[#{type.name}]" end |
#new ⇒ Object
29 30 31 32 33 34 |
# File 'lib/types/types/typed_set.rb', line 29 def new(...) # Fine for this to blow up, because hopefully if they're trying to make a # Set, they don't mind putting (or already have put) a `require 'set'` in # their program directly. Set.new(...) end |
#recursively_valid?(obj) ⇒ Boolean
overrides Base
16 17 18 19 20 |
# File 'lib/types/types/typed_set.rb', line 16 def recursively_valid?(obj) return false if Object.autoload?(:Set) # Set is meant to be autoloaded but not yet loaded, this value can't be a Set return false unless Object.const_defined?(:Set) # Set is not loaded yet obj.is_a?(Set) && super end |
#underlying_class ⇒ Object
6 7 8 |
# File 'lib/types/types/typed_set.rb', line 6 def Set end |
#valid?(obj) ⇒ Boolean
overrides Base
23 24 25 26 27 |
# File 'lib/types/types/typed_set.rb', line 23 def valid?(obj) return false if Object.autoload?(:Set) # Set is meant to be autoloaded but not yet loaded, this value can't be a Set return false unless Object.const_defined?(:Set) # Set is not loaded yet obj.is_a?(Set) end |