class Avromatic::Model::Types::StringType

Constants

INPUT_CLASSES
VALUE_CLASSES

Public Instance Methods

coerce(input) click to toggle source
# File lib/avromatic/model/types/string_type.rb, line 24
def coerce(input)
  if input.nil? || input.is_a?(::String)
    input
  elsif input.is_a?(::Symbol)
    input.to_s
  else
    raise ArgumentError.new("Could not coerce '#{input.inspect}' to #{name}")
  end
end
coerced?(value) click to toggle source
# File lib/avromatic/model/types/string_type.rb, line 38
def coerced?(value)
  value.nil? || value.is_a?(::String)
end
coercible?(input) click to toggle source
# File lib/avromatic/model/types/string_type.rb, line 34
def coercible?(input)
  input.nil? || input.is_a?(::String) || input.is_a?(::Symbol)
end
input_classes() click to toggle source
# File lib/avromatic/model/types/string_type.rb, line 16
def input_classes
  INPUT_CLASSES
end
name() click to toggle source
# File lib/avromatic/model/types/string_type.rb, line 20
def name
  'string'
end
referenced_model_classes() click to toggle source
# File lib/avromatic/model/types/string_type.rb, line 46
def referenced_model_classes
  EMPTY_ARRAY
end
serialize(value, _strict) click to toggle source
# File lib/avromatic/model/types/string_type.rb, line 42
def serialize(value, _strict)
  value
end
value_classes() click to toggle source
# File lib/avromatic/model/types/string_type.rb, line 12
def value_classes
  VALUE_CLASSES
end