Class: JsonTableSchema::Types::Integer
- Inherits:
-
Base
- Object
- Base
- JsonTableSchema::Types::Integer
show all
- Defined in:
- lib/jsontableschema/types/integer.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#cast, #initialize, #set_format, #test
Methods included from Helpers
#convert_to_boolean, #false_values, #get_class_for_type, #true_values, #type_class_lookup
Class Method Details
.supported_constraints ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/jsontableschema/types/integer.rb', line 9
def self.supported_constraints
[
'required',
'pattern',
'enum',
'minimum',
'maximum',
]
end
|
Instance Method Details
#cast_default(value) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/jsontableschema/types/integer.rb', line 23
def cast_default(value)
if value.is_a?(type)
value
else
Integer(value)
end
rescue ArgumentError
raise JsonTableSchema::InvalidCast.new("#{value} is not a #{name}")
end
|
5
6
7
|
# File 'lib/jsontableschema/types/integer.rb', line 5
def name
'integer'
end
|
19
20
21
|
# File 'lib/jsontableschema/types/integer.rb', line 19
def type
::Integer
end
|