Class: ApiBlueprintFormatter::ActionFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- ApiBlueprintFormatter::ActionFormatter
- Defined in:
- lib/api_blueprint/action_formatter.rb
Overview
Parses example metadata for Actions and outputs markdown in accordance with the API Blueprint spec.
Spec: github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md#def-action-section
Instance Attribute Summary collapse
-
#action_metadata ⇒ Object
readonly
Returns the value of attribute action_metadata.
-
#action_name ⇒ Object
readonly
Returns the value of attribute action_name.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(action_name, action_metadata) ⇒ ActionFormatter
constructor
A new instance of ActionFormatter.
Constructor Details
#initialize(action_name, action_metadata) ⇒ ActionFormatter
Returns a new instance of ActionFormatter.
9 10 11 12 13 |
# File 'lib/api_blueprint/action_formatter.rb', line 9 def initialize(action_name, ) @action_name = action_name = @parameters = [:parameters] || [] end |
Instance Attribute Details
#action_metadata ⇒ Object (readonly)
Returns the value of attribute action_metadata.
7 8 9 |
# File 'lib/api_blueprint/action_formatter.rb', line 7 def end |
#action_name ⇒ Object (readonly)
Returns the value of attribute action_name.
7 8 9 |
# File 'lib/api_blueprint/action_formatter.rb', line 7 def action_name @action_name end |
Instance Method Details
#format ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/api_blueprint/action_formatter.rb', line 15 def format output = [] output << "## #{action_name}" output << '' output << [:description].to_s output << '' output += format_parameters output << '' output.join("\n") end |