Class: AppMap::Swagger::MarkdownDescriptions
- Inherits:
-
Object
- Object
- AppMap::Swagger::MarkdownDescriptions
- Defined in:
- lib/appmap/swagger/markdown_descriptions.rb
Overview
Transform description fields into Markdown.
Instance Method Summary collapse
- #converter ⇒ Object
-
#initialize(swagger_yaml) ⇒ MarkdownDescriptions
constructor
A new instance of MarkdownDescriptions.
- #perform ⇒ Object
Constructor Details
#initialize(swagger_yaml) ⇒ MarkdownDescriptions
Returns a new instance of MarkdownDescriptions.
10 11 12 |
# File 'lib/appmap/swagger/markdown_descriptions.rb', line 10 def initialize(swagger_yaml) @swagger_yaml = swagger_yaml end |
Instance Method Details
#converter ⇒ Object
14 15 16 |
# File 'lib/appmap/swagger/markdown_descriptions.rb', line 14 def converter method(:rdoc_to_markdown) end |
#perform ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/appmap/swagger/markdown_descriptions.rb', line 18 def perform to_markdown = lambda do |obj| return obj.each(&to_markdown) if obj.is_a?(Array) return unless obj.is_a?(Hash) description = obj['description'] obj['description'] = converter.(description) if description obj.reject { |k,v| k == 'properties' }.each_value(&to_markdown) obj end to_markdown.(@swagger_yaml.deep_dup) end |