Class: TypedData::Schema::ArrayType
- Inherits:
-
Type
- Object
- Type
- TypedData::Schema::ArrayType
show all
- Defined in:
- lib/typed_data/schema/array_type.rb
Constant Summary
Constants inherited
from Type
Type::SUPPORTED_LOGICAL_TYPES
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(types) ⇒ ArrayType
Returns a new instance of ArrayType.
10
11
12
|
# File 'lib/typed_data/schema/array_type.rb', line 10
def initialize(types)
@element_type = Schema.build_type(types)
end
|
Instance Attribute Details
#element_type ⇒ Object
Returns the value of attribute element_type.
7
8
9
|
# File 'lib/typed_data/schema/array_type.rb', line 7
def element_type
@element_type
end
|
Instance Method Details
#accept(visitor, value) ⇒ Object
14
15
16
|
# File 'lib/typed_data/schema/array_type.rb', line 14
def accept(visitor, value)
visitor.visit_array(self, value)
end
|
#match?(value) ⇒ Boolean
26
27
28
|
# File 'lib/typed_data/schema/array_type.rb', line 26
def match?(value)
value.is_a?(Array) && value.all? { |v| @element_type.match?(v) }
end
|
#primitive? ⇒ Boolean
22
23
24
|
# File 'lib/typed_data/schema/array_type.rb', line 22
def primitive?
false
end
|
#to_s ⇒ Object
18
19
20
|
# File 'lib/typed_data/schema/array_type.rb', line 18
def to_s
"array_#{@element_type}"
end
|