Class: Jsonschema::Generator::TypeDeterminant
- Inherits:
-
Object
- Object
- Jsonschema::Generator::TypeDeterminant
- Defined in:
- lib/jsonschema/generator/type_determinant.rb
Overview
Returns json_schema type according to value class
Class Method Summary collapse
-
.call(value) ⇒ Object
rubocop:disable Metrics/MethodLength.
Class Method Details
.call(value) ⇒ Object
rubocop:disable Metrics/MethodLength
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/jsonschema/generator/type_determinant.rb', line 8 def self.call(value) case value when TrueClass, FalseClass 'boolean' when Float 'number' when Hash 'object' when String, Integer, Array value.class.to_s.downcase when NilClass 'null' else raise Error, "Wrong input type #{value.class}" end end |