Class: RspecApiDocumentation::OpenApi::Parameter
- Defined in:
- lib/rspec_api_documentation/open_api/parameter.rb
Constant Summary
Constants inherited from Node
Instance Attribute Summary collapse
-
#value ⇒ Object
Required to write example values to description of parameter when option ‘with_example: true` is provided.
-
#with_example ⇒ Object
Returns the value of attribute with_example.
Attributes inherited from Node
Instance Method Summary collapse
- #description_with_example ⇒ Object (also: #description)
Methods inherited from Node
add_setting, #add_setting, #as_json, #assign_setting, #existing_settings, #initialize, #safe_assign_setting, #setting, #setting_exist?, #setting_schema
Constructor Details
This class inherits a constructor from RspecApiDocumentation::OpenApi::Node
Instance Attribute Details
#value ⇒ Object
Required to write example values to description of parameter when option ‘with_example: true` is provided
5 6 7 |
# File 'lib/rspec_api_documentation/open_api/parameter.rb', line 5 def value @value end |
#with_example ⇒ Object
Returns the value of attribute with_example.
6 7 8 |
# File 'lib/rspec_api_documentation/open_api/parameter.rb', line 6 def with_example @with_example end |
Instance Method Details
#description_with_example ⇒ Object Also known as: description
20 21 22 23 24 25 26 27 |
# File 'lib/rspec_api_documentation/open_api/parameter.rb', line 20 def description_with_example str = description_without_example.dup || '' if with_example && value str << "\n" unless str.empty? str << "Eg, `#{value}`" end str end |