Class: T::Types::TypedHash::Untyped

Inherits:
TypedHash
  • Object
show all
Defined in:
lib/types/types/typed_hash.rb

Defined Under Namespace

Modules: Private

Instance Method Summary collapse

Constructor Details

#initializeUntyped

Returns a new instance of Untyped.



49
50
51
52
53
# File 'lib/types/types/typed_hash.rb', line 49

def initialize
  # Use the INSTANCE constant directly (rather than `T.untyped`) so this
  # can be built at load time, mirroring TypedArray::Untyped.
  super(keys: T::Types::Untyped::Private::INSTANCE, values: T::Types::Untyped::Private::INSTANCE)
end

Instance Method Details

#freezeObject



59
60
61
62
# File 'lib/types/types/typed_hash.rb', line 59

def freeze
  build_type # force lazy initialization before freezing the object
  super
end

#valid?(obj) ⇒ Boolean

Returns:



55
56
57
# File 'lib/types/types/typed_hash.rb', line 55

def valid?(obj)
  obj.is_a?(Hash)
end