Class: EasyTalk::Builders::StringBuilder

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

Overview

Builder class for string properties.

Direct Known Subclasses

DateBuilder, DatetimeBuilder, TimeBuilder

Constant Summary collapse

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

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 = {}) ⇒ StringBuilder

Returns a new instance of StringBuilder.



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

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