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

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

Instance Method Summary collapse

Methods inherited from T::Types::TypedSet

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

Methods inherited from T::Types::TypedEnumerable

#build_type, #describe_obj, #name, #recursively_valid?, #type, #underlying_class

Methods inherited from Base

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

Constructor Details

#initializeUntyped

Returns a new instance of Untyped.



39
40
41
# File 'lib/types/types/typed_set.rb', line 39

def initialize
  super(T::Types::Untyped::Private::INSTANCE)
end

Instance Method Details

#valid?(obj) ⇒ Boolean

Returns:



43
44
45
46
47
48
# File 'lib/types/types/typed_set.rb', line 43

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