class FlatKit::FieldType::NullType

Constants

REGEX

Public Class Methods

coerce(data) click to toggle source
# File lib/flat_kit/field_type/null_type.rb, line 22
def self.coerce(data)
  case data
  when nil
    data
  when String
    return nil if REGEX.match?(data)
    CoerceFailure
  else
    CoerceFailure
  end
end
matches?(data) click to toggle source
# File lib/flat_kit/field_type/null_type.rb, line 11
def self.matches?(data)
  case data
  when nil
    true
  when String
    REGEX.match?(data)
  else
    false
  end
end
type_name() click to toggle source
# File lib/flat_kit/field_type/null_type.rb, line 7
def self.type_name
  "null"
end