Class: TypedData::Schema::IntType
- Inherits:
-
Type
- Object
- Type
- TypedData::Schema::IntType
show all
- Defined in:
- lib/typed_data/schema/int_type.rb
Constant Summary
collapse
- VALUE_RANGE =
-2**31 .. 2**31 - 1
- SUPPORTED_LOGICAL_TYPES =
%w[date time-millis]
Instance Method Summary
collapse
Methods inherited from Type
#initialize
Instance Method Details
#accept(visitor, value) ⇒ Object
9
10
11
|
# File 'lib/typed_data/schema/int_type.rb', line 9
def accept(visitor, value)
visitor.visit_int(self, @logical_type, value)
end
|
#match?(value) ⇒ Boolean
25
26
27
|
# File 'lib/typed_data/schema/int_type.rb', line 25
def match?(value)
value.is_a?(Integer) && VALUE_RANGE.cover?(value)
end
|
#primitive? ⇒ Boolean
21
22
23
|
# File 'lib/typed_data/schema/int_type.rb', line 21
def primitive?
true
end
|
#to_s ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/typed_data/schema/int_type.rb', line 13
def to_s
if @logical_type
"#{@name}_#{@logical_type.gsub("-", "_")}"
else
@name
end
end
|