Class: FlatKit::FieldType::UnknownType
- Inherits:
-
FlatKit::FieldType
- Object
- FlatKit::FieldType
- FlatKit::FieldType::UnknownType
- Defined in:
- lib/flat_kit/field_type/unknown_type.rb
Overview
Internal: Unknown type, this is what we use for unknown values in the data
Constant Summary collapse
- REGEX =
%r{\A(na|n/a|unk|unknown)\Z}i
Constants inherited from FlatKit::FieldType
Class Method Summary collapse
Methods inherited from FlatKit::FieldType
best_guess, candidate_types, weight, weights
Methods included from DescendantTracker
#children, #find_child, #find_children, #inherited
Class Method Details
.coerce(data) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/flat_kit/field_type/unknown_type.rb', line 21 def self.coerce(data) return data if REGEX.match?(data) CoerceFailure rescue StandardError CoerceFailure end |
.matches?(data) ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/flat_kit/field_type/unknown_type.rb', line 14 def self.matches?(data) return false unless data.is_a?(String) return true if data.empty? REGEX.match?(data) end |
.type_name ⇒ Object
10 11 12 |
# File 'lib/flat_kit/field_type/unknown_type.rb', line 10 def self.type_name "unknown" end |