Class: Osb::Internal::TypedArray Private

Inherits:
Object
  • Object
show all
Defined in:
lib/osb/assert.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ TypedArray

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TypedArray.

Parameters:

  • type (Class)


20
21
22
# File 'lib/osb/assert.rb', line 20

def initialize(type)
  @type = type
end

Instance Method Details

#nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/osb/assert.rb', line 24

def name
  "Array<#{@type.name}>"
end

#valid?(object) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



28
29
30
# File 'lib/osb/assert.rb', line 28

def valid?(object)
  object.is_a?(Array) && object.all? { |value| value.is_a?(@type) }
end