Class: ApiBlueprintFormatter::ExampleFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- ApiBlueprintFormatter::ExampleFormatter
- Defined in:
- lib/api_blueprint/example_formatter.rb
Overview
Parses example metadata for Examples (Request+Response) and outputs markdown in accordance with the API Blueprint spec.
Specs:
- https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md#def-request-section
- https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md#response-section
Instance Attribute Summary collapse
-
#example_metadata ⇒ Object
readonly
Returns the value of attribute example_metadata.
Instance Method Summary collapse
- #example_description ⇒ Object
- #format ⇒ Object
-
#initialize(example_description, example_metadata) ⇒ ExampleFormatter
constructor
A new instance of ExampleFormatter.
Constructor Details
#initialize(example_description, example_metadata) ⇒ ExampleFormatter
11 12 13 14 |
# File 'lib/api_blueprint/example_formatter.rb', line 11 def initialize(example_description, ) @example_description = example_description = end |
Instance Attribute Details
#example_metadata ⇒ Object (readonly)
Returns the value of attribute example_metadata.
9 10 11 |
# File 'lib/api_blueprint/example_formatter.rb', line 9 def end |
Instance Method Details
#example_description ⇒ Object
22 23 24 |
# File 'lib/api_blueprint/example_formatter.rb', line 22 def example_description sanitize_api_identifier(@example_description) end |
#format ⇒ Object
16 17 18 19 20 |
# File 'lib/api_blueprint/example_formatter.rb', line 16 def format out = '' out << format_request out << format_response end |