Class: T::Types::TypedSet::Untyped

Inherits:
T::Types::TypedSet show all
Defined in:
lib/types/types/typed_set.rb

Instance Attribute Summary

Attributes inherited from T::Types::TypedSet

#type

Attributes inherited from T::Types::TypedEnumerable

#type

Instance Method Summary collapse

Methods inherited from T::Types::TypedSet

#name, #new, #recursively_valid?, #underlying_class

Methods inherited from T::Types::TypedEnumerable

#describe_obj, #name, #recursively_valid?, #underlying_class

Methods inherited from Base

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

Constructor Details

#initializeUntyped

Returns a new instance of Untyped.



41
42
43
# File 'lib/types/types/typed_set.rb', line 41

def initialize
  super(T.untyped)
end

Instance Method Details

#valid?(obj) ⇒ Boolean

Returns:



45
46
47
48
49
50
# File 'lib/types/types/typed_set.rb', line 45

def valid?(obj)
  # Re-implements non_forcing_is_a?
  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