Class: SoberSwag::Reporting::Output::Described
- Defined in:
- lib/sober_swag/reporting/output/described.rb
Overview
Add a description onto an object.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
Description of output.
-
#output ⇒ Interface
readonly
Output to describe.
Instance Method Summary collapse
- #call(value) ⇒ Object
-
#initialize(output, description) ⇒ Described
constructor
A new instance of Described.
- #serialize_report(value) ⇒ Object
- #swagger_schema ⇒ Object
Methods inherited from Base
Methods included from Interface
#call!, #described, #enum, #in_range, #list, #nilable, #partitioned, #referenced, #reporting?, #serialize, #via_map
Constructor Details
#initialize(output, description) ⇒ Described
Returns a new instance of Described.
7 8 9 10 |
# File 'lib/sober_swag/reporting/output/described.rb', line 7 def initialize(output, description) @output = output @description = description end |
Instance Attribute Details
#description ⇒ String (readonly)
Returns description of output.
18 19 20 |
# File 'lib/sober_swag/reporting/output/described.rb', line 18 def description @description end |
#output ⇒ Interface (readonly)
Returns output to describe.
14 15 16 |
# File 'lib/sober_swag/reporting/output/described.rb', line 14 def output @output end |
Instance Method Details
#call(value) ⇒ Object
20 21 22 |
# File 'lib/sober_swag/reporting/output/described.rb', line 20 def call(value) output.call(value) end |
#serialize_report(value) ⇒ Object
24 25 26 |
# File 'lib/sober_swag/reporting/output/described.rb', line 24 def serialize_report(value) output.serialize_report(value) end |
#swagger_schema ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sober_swag/reporting/output/described.rb', line 28 def swagger_schema schema, found = output.swagger_schema merged = if schema.key?(:$ref) { allOf: [schema] } else schema end.merge(description: description) [merged, found] end |