module Attributor::Numeric::ClassMethods

Public Instance Methods

as_json_schema( shallow: false, example: nil, attribute_options: {} ) click to toggle source
Calls superclass method
# File lib/attributor/families/numeric.rb, line 18
def as_json_schema( shallow: false, example: nil, attribute_options: {} )
  h = super
  opts = ( self.respond_to?(:options) ) ? self.options.merge( attribute_options ) : attribute_options
  h[:minimum] = opts[:min] if opts[:min]
  h[:maximum] = opts[:max] if opts[:max]
  # We're not explicitly setting false to exclusiveMinimum and exclusiveMaximum (as that's the default)
  h
end
family() click to toggle source
# File lib/attributor/families/numeric.rb, line 14
def family
  'numeric'
end
native_type() click to toggle source
# File lib/attributor/families/numeric.rb, line 10
def native_type
  raise NotImplementedError
end