Class: Shale::Schema::JSONGenerator::Float Private

Inherits:
Base
  • Object
show all
Defined in:
lib/shale/schema/json_generator/float.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class representing JSON Schema float type

Instance Attribute Summary

Attributes inherited from Base

#name, #nullable, #schema

Instance Method Summary collapse

Methods inherited from Base

#as_json, #initialize

Constructor Details

This class inherits a constructor from Shale::Schema::JSONGenerator::Base

Instance Method Details

#as_typeHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return JSON Schema fragment as Ruby Hash



17
18
19
20
21
22
23
24
25
# File 'lib/shale/schema/json_generator/float.rb', line 17

def as_type
  { 'type' => 'number',
    'exclusiveMinimum' => schema[:exclusive_minimum],
    'exclusiveMaximum' => schema[:exclusive_maximum],
    'minimum' => schema[:minimum],
    'maximum' => schema[:maximum],
    'multipleOf' => schema[:multiple_of],
    'description' => schema[:description] }.compact
end