Module: Meta::JsonSchema::TypeConverter

Defined in:
lib/meta/json_schema/support/type_converter.rb

Class Method Summary collapse

Class Method Details

.convert_value(value, target_type) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/meta/json_schema/support/type_converter.rb', line 88

def convert_value(value, target_type)
  return nil if value.nil?
  raise JsonSchema::TypeConvertError, I18n.t(:'json_schema.errors.type_convert.unknown') unless @definity_types.keys.include?(target_type)
  return value if match_definity_types?(value, target_type)

  convert_to_definity_type(value, target_type)
end