Class: TableSchema::Types::Boolean
- Inherits:
-
Base
- Object
- Base
- TableSchema::Types::Boolean
show all
- Defined in:
- lib/tableschema/types/boolean.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#cast, #initialize, #test
Methods included from Helpers
#convert_to_boolean, #deep_symbolize_keys, #false_values, #get_class_for_type, #true_values, #type_class_lookup
Class Method Details
.supported_constraints ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/tableschema/types/boolean.rb', line 15
def self.supported_constraints
[
'required',
'pattern',
'enum',
]
end
|
Instance Method Details
#cast_default(value) ⇒ Object
27
28
29
30
31
|
# File 'lib/tableschema/types/boolean.rb', line 27
def cast_default(value)
value = convert_to_boolean(value)
raise TableSchema::InvalidCast.new("#{value} is not a #{name}") if value.nil?
value
end
|
11
12
13
|
# File 'lib/tableschema/types/boolean.rb', line 11
def name
'boolean'
end
|
23
24
25
|
# File 'lib/tableschema/types/boolean.rb', line 23
def type
::Boolean
end
|