Class: EasyTalk::Builders::TypedArrayBuilder

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

Overview

Builder class for array properties.

Constant Summary collapse

VALID_OPTIONS =
{
  min_items: { type: Integer, key: :minItems },
  max_items: { type: Integer, key: :maxItems },
  unique_items: { type: T::Boolean, key: :uniqueItems },
  enum: { type: T::Array[T.untyped], key: :enum },
  const: { type: T::Array[T.untyped], key: :const }
}.freeze

Constants inherited from BaseBuilder

BaseBuilder::COMMON_OPTIONS

Instance Attribute Summary collapse

Attributes inherited from BaseBuilder

#name, #options

Instance Method Summary collapse

Methods included from CollectionHelpers

collection_type?

Methods inherited from BaseBuilder

#build, collection_type?

Constructor Details

#initialize(name, type, constraints = {}) ⇒ TypedArrayBuilder

Returns a new instance of TypedArrayBuilder.



23
24
25
26
27
28
# File 'lib/easy_talk/builders/typed_array_builder.rb', line 23

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

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



20
21
22
# File 'lib/easy_talk/builders/typed_array_builder.rb', line 20

def type
  @type
end