Sha256: 06faa5c3f1b8ecbe104659c237a334719b14676ebe012bbe2ecdbd59470beac7

Contents?: true

Size: 989 Bytes

Versions: 7

Compression:

Stored size: 989 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_builder'

module EasyTalk
  module Builders
    # Builder class for integer properties.
    class IntegerBuilder < BaseBuilder
      extend T::Sig
      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

      # Initializes a new instance of the IntegerBuilder class.
      sig { params(name: Symbol, _type: T.untyped, constraints: Hash).void }
      def initialize(name, _type = nil, constraints = {})
        super(name, { type: 'integer' }, constraints, VALID_OPTIONS)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
easy_talk-0.1.6 lib/easy_talk/builders/integer_builder.rb
easy_talk-0.1.5 lib/easy_talk/builders/integer_builder.rb
easy_talk-0.1.4 lib/easy_talk/builders/integer_builder.rb
easy_talk-0.1.3 lib/easy_talk/builders/integer_builder.rb
easy_talk-0.1.2 lib/easy_talk/builders/integer_builder.rb
easy_talk-0.1.1 lib/easy_talk/builders/integer_builder.rb
easy_talk-0.1.0 lib/easy_talk/builders/integer_builder.rb