Class: SexyJSONSchemas::Properties::Number

Inherits:
Base
  • Object
show all
Defined in:
lib/sexy_json_schemas/properties/number.rb

Direct Known Subclasses

Integer

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from SexyJSONSchemas::Properties::Base

Instance Method Details

#as_jsonObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sexy_json_schemas/properties/number.rb', line 8

def as_json
  super.tap do |json|
    if @options[:minimum]
      json['minimum'] = @options[:minimum]
    end

    if @options[:maximum]
      json['maximum'] = @options[:maximum]
    end
  end
end

#typeObject



4
5
6
# File 'lib/sexy_json_schemas/properties/number.rb', line 4

def type
  "number"
end