Sha256: 477bc5f9075837746e414aa5eec4772f348dec3fb1bb77208c4ffe758637c2c0

Contents?: true

Size: 707 Bytes

Versions: 7

Compression:

Stored size: 707 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_builder'

module EasyTalk
  module Builders
    # Builder class for boolean properties.
    class BooleanBuilder < BaseBuilder
      extend T::Sig

      # VALID_OPTIONS defines the valid options for a boolean property.
      VALID_OPTIONS = {
        enum: { type: T::Array[T::Boolean], key: :enum },
        const: { type: T::Boolean, key: :const },
        default: { type: T::Boolean, key: :default }
      }.freeze

      sig { params(name: Symbol, _type: T.untyped, constraints: Hash).void }
      def initialize(name, _type = nil, constraints = {})
        super(name, { type: 'boolean' }, 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/boolean_builder.rb
easy_talk-0.1.5 lib/easy_talk/builders/boolean_builder.rb
easy_talk-0.1.4 lib/easy_talk/builders/boolean_builder.rb
easy_talk-0.1.3 lib/easy_talk/builders/boolean_builder.rb
easy_talk-0.1.2 lib/easy_talk/builders/boolean_builder.rb
easy_talk-0.1.1 lib/easy_talk/builders/boolean_builder.rb
easy_talk-0.1.0 lib/easy_talk/builders/boolean_builder.rb