Class: FlatKit::FieldType::UnknownType
Constant Summary
collapse
- REGEX =
%r{\A(na|n/a|unk|unknown)\Z}i
CoerceFailure
Class Method Summary
collapse
best_guess, candidate_types, weight
#children, #find_child, #find_children, #inherited
Class Method Details
.coerce(data) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/flat_kit/field_type/unknown_type.rb', line 17
def self.coerce(data)
return data if REGEX.match?(data)
return CoerceFailure
rescue
return CoerceFailure
end
|
.matches?(data) ⇒ Boolean
11
12
13
14
15
|
# File 'lib/flat_kit/field_type/unknown_type.rb', line 11
def self.matches?(data)
return false unless data.kind_of?(String)
return true if data.length == 0
return REGEX.match?(data)
end
|
.type_name ⇒ Object
7
8
9
|
# File 'lib/flat_kit/field_type/unknown_type.rb', line 7
def self.type_name
"unknown"
end
|