Class: Apiculture::MethodDocumentation
- Inherits:
-
Object
- Object
- Apiculture::MethodDocumentation
- Defined in:
- lib/apiculture/method_documentation.rb
Overview
structure in one go.
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(action_definition, mountpoint = '') ⇒ MethodDocumentation
constructor
A new instance of MethodDocumentation.
-
#to_html_fragment ⇒ Object
Compose an HTML string by converting the result of
to_markdown
. -
#to_markdown ⇒ Object
Compose a Markdown definition of the action.
Constructor Details
#initialize(action_definition, mountpoint = '') ⇒ MethodDocumentation
Returns a new instance of MethodDocumentation.
10 11 12 13 |
# File 'lib/apiculture/method_documentation.rb', line 10 def initialize(action_definition, mountpoint = '') @definition = action_definition @mountpoint = mountpoint end |
Instance Method Details
#to_html_fragment ⇒ Object
Compose an HTML string by converting the result of to_markdown
28 29 30 31 |
# File 'lib/apiculture/method_documentation.rb', line 28 def to_html_fragment require 'rdiscount' RDiscount.new(to_markdown).to_html end |
#to_markdown ⇒ Object
Compose a Markdown definition of the action
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/apiculture/method_documentation.rb', line 16 def to_markdown m = MDBuf.new m << "## #{@definition.http_verb.upcase} #{@mountpoint}#{@definition.path}" m << @definition.description m << route_parameters_table m << request_parameters_table m << possible_responses_table m.to_s end |