Class: Apiwork::Introspection::Param::Record
- Defined in:
- lib/apiwork/introspection/param/record.rb
Overview
Record param representing key-value maps with typed values.
Instance Method Summary collapse
-
#concrete? ⇒ Boolean
Whether this param is concrete.
-
#default ⇒ Object?
The default for this param.
-
#example ⇒ Object?
The example for this param.
-
#of ⇒ Param::Base?
The value type for this record.
-
#record? ⇒ Boolean
Whether this param is a record.
-
#to_h ⇒ Hash
Converts this param to a hash.
Methods inherited from Base
#array?, #binary?, #boolean?, #boundable?, #date?, #datetime?, #decimal?, #default?, #deprecated?, #description, #enum?, #enum_reference?, #formattable?, #initialize, #integer?, #literal?, #nullable?, #number?, #numeric?, #object?, #optional?, #partial?, #reference?, #scalar?, #string?, #tag, #time?, #type, #union?, #unknown?, #uuid?
Constructor Details
This class inherits a constructor from Apiwork::Introspection::Param::Base
Instance Method Details
#concrete? ⇒ Boolean
Whether this param is concrete.
56 57 58 |
# File 'lib/apiwork/introspection/param/record.rb', line 56 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.
24 25 26 |
# File 'lib/apiwork/introspection/param/record.rb', line 24 def default @dump[:default] end |
#example ⇒ Object?
The example for this param.
32 33 34 |
# File 'lib/apiwork/introspection/param/record.rb', line 32 def example @dump[:example] end |
#of ⇒ Param::Base?
The value type for this record.
40 41 42 |
# File 'lib/apiwork/introspection/param/record.rb', line 40 def of @of ||= @dump[:of] ? Param.build(@dump[:of]) : nil end |
#record? ⇒ Boolean
Whether this param is a record.
48 49 50 |
# File 'lib/apiwork/introspection/param/record.rb', line 48 def record? true end |
#to_h ⇒ Hash
Converts this param to a hash.
64 65 66 67 68 69 70 |
# File 'lib/apiwork/introspection/param/record.rb', line 64 def to_h result = super result[:default] = default result[:example] = example result[:of] = of&.to_h result end |