Class: FlatKit::FieldType::StringType

Inherits:
FieldType
  • Object
show all
Defined in:
lib/flat_kit/field_type/string_type.rb

Overview

Internal: StringType is essentially a fallback - hence its lower weight than other types that might have string representations.

Class Method Summary collapse

Class Method Details

.coerce(data) ⇒ Object



17
18
19
20
21
# File 'lib/flat_kit/field_type/string_type.rb', line 17

def self.coerce(data)
  data.to_s
rescue StandardError => _e
  CoerceFailure
end

.matches?(data) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/flat_kit/field_type/string_type.rb', line 13

def self.matches?(data)
  data.is_a?(String)
end

.type_nameObject



9
10
11
# File 'lib/flat_kit/field_type/string_type.rb', line 9

def self.type_name
  "string"
end