Class: TypedData::Schema::Type
- Inherits:
-
Object
- Object
- TypedData::Schema::Type
show all
- Defined in:
- lib/typed_data/schema/type.rb
Direct Known Subclasses
ArrayType, BooleanType, BytesType, EnumType, FloatType, IntType, LongType, MapType, NullType, RecordType, StringType, UnionType
Constant Summary
collapse
- SUPPORTED_LOGICAL_TYPES =
[]
Instance Method Summary
collapse
Constructor Details
#initialize(name, logical_type = nil) ⇒ Type
Returns a new instance of Type.
9
10
11
12
13
14
15
|
# File 'lib/typed_data/schema/type.rb', line 9
def initialize(name, logical_type = nil)
@name = name
if logical_type && !self.class::SUPPORTED_LOGICAL_TYPES.include?(logical_type)
raise UnsupportedType, %Q{#{name} doesn't support the logical type "#{logical_type}"}
end
@logical_type = logical_type
end
|
Instance Method Details
#accept(visitor, value) ⇒ Object
17
18
19
|
# File 'lib/typed_data/schema/type.rb', line 17
def accept(visitor, value)
visitor.visit(self, value)
end
|
#match?(value) ⇒ Boolean
29
30
31
|
# File 'lib/typed_data/schema/type.rb', line 29
def match?(value)
raise NotImplementedError, "#{self.class}##{__method__} is not implement"
end
|
#primitive? ⇒ Boolean
25
26
27
|
# File 'lib/typed_data/schema/type.rb', line 25
def primitive?
raise NotImplementedError, "#{self.class}##{__method__} is not implement"
end
|
#to_s ⇒ Object
21
22
23
|
# File 'lib/typed_data/schema/type.rb', line 21
def to_s
@name
end
|