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 homogeneous array properties (T::Array[Type]).

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 },
  ref: { type: T::Boolean, key: :ref }
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of TypedArrayBuilder.



25
26
27
28
29
30
31
# File 'lib/easy_talk/builders/typed_array_builder.rb', line 25

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

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



22
23
24
# File 'lib/easy_talk/builders/typed_array_builder.rb', line 22

def type
  @type
end

Class Method Details

.collection_type?Boolean Originally defined in module CollectionHelpers

Returns:

  • (Boolean)