Class: T::Types::TypedArray

Inherits:
TypedEnumerable show all
Defined in:
lib/types/types/typed_array.rb

Instance Attribute Summary

Attributes inherited from TypedEnumerable

#type

Instance Method Summary collapse

Methods inherited from TypedEnumerable

#describe_obj, #initialize

Methods inherited from Base

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

Constructor Details

This class inherits a constructor from T::Types::TypedEnumerable

Instance Method Details

#nameObject



7
8
9
# File 'lib/types/types/typed_array.rb', line 7

def name
  "T::Array[#{@type.name}]"
end

#new(*args) ⇒ Object

rubocop:disable PrisonGuard/BanBuiltinMethodOverride



16
17
18
# File 'lib/types/types/typed_array.rb', line 16

def new(*args) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
  Array.new(*T.unsafe(args))
end

#valid?(obj) ⇒ Boolean

Returns:



12
13
14
# File 'lib/types/types/typed_array.rb', line 12

def valid?(obj)
  obj.is_a?(Array) && super
end