Class: Apiwork::Introspection::Param::Array
- Defined in:
- lib/apiwork/introspection/param/array.rb
Overview
Array param representing ordered collections.
Instance Method Summary collapse
-
#array? ⇒ Boolean
Whether this param is an array.
-
#boundable? ⇒ Boolean
Whether this param is boundable.
-
#concrete? ⇒ Boolean
Whether this param is concrete.
-
#default ⇒ Object?
The default for this param.
-
#example ⇒ Object?
The example for this param.
-
#max ⇒ Integer?
The maximum for this param.
-
#min ⇒ Integer?
The minimum for this param.
-
#of ⇒ Param::Base?
The of for this param.
-
#shape ⇒ Hash{Symbol => Param::Base}
The shape for this param.
-
#to_h ⇒ Hash
Converts this param to a hash.
Methods inherited from Base
#binary?, #boolean?, #date?, #datetime?, #decimal?, #default?, #deprecated?, #description, #enum?, #enum_reference?, #formattable?, #initialize, #integer?, #literal?, #nullable?, #number?, #numeric?, #object?, #optional?, #partial?, #record?, #reference?, #scalar?, #string?, #tag, #time?, #type, #union?, #unknown?, #uuid?
Constructor Details
This class inherits a constructor from Apiwork::Introspection::Param::Base
Instance Method Details
#array? ⇒ Boolean
Whether this param is an array.
80 81 82 |
# File 'lib/apiwork/introspection/param/array.rb', line 80 def array? true end |
#boundable? ⇒ Boolean
Whether this param is boundable.
96 97 98 |
# File 'lib/apiwork/introspection/param/array.rb', line 96 def boundable? true end |
#concrete? ⇒ Boolean
Whether this param is concrete.
88 89 90 |
# File 'lib/apiwork/introspection/param/array.rb', line 88 def concrete? true end |
#default ⇒ Object?
The default for this param.
Returns ‘nil` for both “no default” and “default is explicitly `nil`”. Use Base#default? to distinguish these cases.
30 31 32 |
# File 'lib/apiwork/introspection/param/array.rb', line 30 def default @dump[:default] end |
#example ⇒ Object?
The example for this param.
38 39 40 |
# File 'lib/apiwork/introspection/param/array.rb', line 38 def example @dump[:example] end |
#max ⇒ Integer?
The maximum for this param.
72 73 74 |
# File 'lib/apiwork/introspection/param/array.rb', line 72 def max @dump[:max] end |
#min ⇒ Integer?
The minimum for this param.
64 65 66 |
# File 'lib/apiwork/introspection/param/array.rb', line 64 def min @dump[:min] end |
#of ⇒ Param::Base?
The of for this param.
46 47 48 |
# File 'lib/apiwork/introspection/param/array.rb', line 46 def of @of ||= @dump[:of] ? Param.build(@dump[:of]) : nil end |
#shape ⇒ Hash{Symbol => Param::Base}
The shape for this param.
54 55 56 57 58 |
# File 'lib/apiwork/introspection/param/array.rb', line 54 def shape return @shape if defined?(@shape) @shape = @dump[:shape]&.transform_values { |dump| Param.build(dump) } || {} end |
#to_h ⇒ Hash
Converts this param to a hash.
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/apiwork/introspection/param/array.rb', line 104 def to_h result = super result[:default] = default result[:example] = example result[:max] = max result[:min] = min result[:of] = of&.to_h result[:shape] = shape.transform_values(&:to_h) result end |