Class: EasyTalk::Builders::TypedArrayBuilder
- Inherits:
-
BaseBuilder
- Object
- BaseBuilder
- EasyTalk::Builders::TypedArrayBuilder
- 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
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
- .collection_type? ⇒ Boolean extended from CollectionHelpers
Instance Method Summary collapse
-
#initialize(name, type, constraints = {}) ⇒ TypedArrayBuilder
constructor
A new instance of TypedArrayBuilder.
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) update_option_types super(name, { type: 'array' }, constraints, ) end |
Instance Attribute Details
#type ⇒ Object (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 |