Class: Apiwork::Introspection::Param::Object
- Defined in:
- lib/apiwork/introspection/param/object.rb
Overview
Object param representing structured data with named fields.
Instance Method Summary collapse
-
#object? ⇒ Boolean
Whether this param is an object.
-
#partial? ⇒ Boolean
Whether this param is partial.
-
#shape ⇒ Hash{Symbol => Param::Base}
The shape for this param.
-
#to_h ⇒ Hash
Converts this param to a hash.
Methods inherited from Base
#array?, #binary?, #boolean?, #boundable?, #concrete?, #date?, #datetime?, #decimal?, #default?, #deprecated?, #description, #enum?, #enum_reference?, #formattable?, #initialize, #integer?, #literal?, #nullable?, #number?, #numeric?, #optional?, #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
#object? ⇒ Boolean
Whether this param is an object.
42 43 44 |
# File 'lib/apiwork/introspection/param/object.rb', line 42 def object? true end |
#partial? ⇒ Boolean
Whether this param is partial.
34 35 36 |
# File 'lib/apiwork/introspection/param/object.rb', line 34 def partial? @dump[:partial] end |
#shape ⇒ Hash{Symbol => Param::Base}
The shape for this param.
24 25 26 27 28 |
# File 'lib/apiwork/introspection/param/object.rb', line 24 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.
50 51 52 53 54 55 |
# File 'lib/apiwork/introspection/param/object.rb', line 50 def to_h result = super result[:partial] = partial? result[:shape] = shape.transform_values(&:to_h) result end |