Class: Apipie::Generator::Swagger::ParamDescription::ReferencedComposite
- Inherits:
-
Object
- Object
- Apipie::Generator::Swagger::ParamDescription::ReferencedComposite
- Defined in:
- lib/apipie/generator/swagger/param_description/referenced_composite.rb
Overview
A Composite that keeps track when a param description has been added to references
and returns the reference instead of the complete object
Instance Method Summary collapse
-
#initialize(composite, param_type) ⇒ ReferencedComposite
constructor
A new instance of ReferencedComposite.
- #to_swagger ⇒ Object
Constructor Details
#initialize(composite, param_type) ⇒ ReferencedComposite
Returns a new instance of ReferencedComposite.
6 7 8 9 |
# File 'lib/apipie/generator/swagger/param_description/referenced_composite.rb', line 6 def initialize(composite, param_type) @composite = composite @param_type = param_type.to_sym end |
Instance Method Details
#to_swagger ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/apipie/generator/swagger/param_description/referenced_composite.rb', line 11 def to_swagger return ref_to(:name) if added?(:name) schema_obj = @composite.to_swagger return nil if schema_obj.nil? add(schema_obj) { '$ref' => ref_to(@param_type) } end |