Class: EasyTalk::Builders::IntegerBuilder

Inherits:
BaseBuilder
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/easy_talk/builders/integer_builder.rb

Overview

Builder class for integer properties.

Constant Summary collapse

VALID_OPTIONS =
{
  minimum: { type: Integer, key: :minimum },
  maximum: { type: Integer, key: :maximum },
  exclusive_minimum: { type: Integer, key: :exclusiveMinimum },
  exclusive_maximum: { type: Integer, key: :exclusiveMaximum },
  multiple_of: { type: Integer, key: :multipleOf },
  enum: { type: T::Array[Integer], key: :enum },
  const: { type: Integer, key: :const },
  default: { type: Integer, 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 = {}) ⇒ IntegerBuilder

Returns a new instance of IntegerBuilder.



23
24
25
# File 'lib/easy_talk/builders/integer_builder.rb', line 23

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