Sha256: dd2a0299ac081e8ed418e29d1dc38df52fa2ab6ad2c6ad5e6eda0cdad37fa553

Contents?: true

Size: 923 Bytes

Versions: 6

Compression:

Stored size: 923 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_builder'
require 'sorbet-runtime' # Add the import statement for the T module

module EasyTalk
  module Builders
    # Builder class for string properties.
    class StringBuilder < BaseBuilder
      extend T::Sig
      VALID_OPTIONS = {
        format: { type: String, key: :format },
        pattern: { type: String, key: :pattern },
        min_length: { type: Integer, key: :minLength },
        max_length: { type: Integer, key: :maxLength },
        enum: { type: T::Array[String], key: :enum },
        const: { type: String, key: :const },
        default: { type: String, key: :default },
        optional: { type: T::Boolean, key: :optional }
      }.freeze

      sig { params(name: Symbol, constraints: Hash).void }
      def initialize(name, constraints = {})
        super(name, { type: 'string' }, constraints, VALID_OPTIONS)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
easy_talk-1.0.2 lib/easy_talk/builders/string_builder.rb
easy_talk-1.0.1 lib/easy_talk/builders/string_builder.rb
easy_talk-1.0.0 lib/easy_talk/builders/string_builder.rb
easy_talk-0.2.1 lib/easy_talk/builders/string_builder.rb
easy_talk-0.2.0 lib/easy_talk/builders/string_builder.rb
easy_talk-0.1.10 lib/easy_talk/builders/string_builder.rb