Class: EasyTalk::Builders::NumberBuilder

Inherits:
BaseBuilder show all
Defined in:
lib/easy_talk/builders/number_builder.rb

Overview

Builder class for number properties.

Constant Summary collapse

VALID_OPTIONS =
{
  multiple_of: { type: T.any(Integer, Float), key: :multipleOf },
  minimum: { type: T.any(Integer, Float), key: :minimum },
  maximum: { type: T.any(Integer, Float), key: :maximum },
  exclusive_minimum: { type: T.any(Integer, Float), key: :exclusiveMinimum },
  exclusive_maximum: { type: T.any(Integer, Float), key: :exclusiveMaximum },
  enum: { type: T::Array[T.any(Integer, Float)], key: :enum },
  const: { type: T.any(Integer, Float), key: :const },
  default: { type: T.any(Integer, Float), key: :default }
}.freeze

Constants inherited from BaseBuilder

BaseBuilder::COMMON_OPTIONS

Instance Attribute Summary

Attributes inherited from BaseBuilder

#name, #options, #schema

Instance Method Summary collapse

Methods inherited from BaseBuilder

#build, collection_type?

Constructor Details

#initialize(name, constraints = {}) ⇒ NumberBuilder

Returns a new instance of NumberBuilder.



22
23
24
# File 'lib/easy_talk/builders/number_builder.rb', line 22

def initialize(name, constraints = {})
  super(name, { type: 'number' }, constraints, VALID_OPTIONS)
end