Module: YARD::Markdown::DocumentationHelper
- Defined in:
- lib/yard/markdown/documentation_helper.rb
Overview
Converts YARD docstrings into Markdown-friendly text.
Instance Method Summary collapse
-
#documented_text(object) ⇒ String
Returns the rendered documentation text for an object.
-
#rdoc_to_md(docstring) ⇒ String
Converts an RDoc-formatted docstring to Markdown.
Instance Method Details
#documented_text(object) ⇒ String
Returns the rendered documentation text for an object.
13 14 15 16 17 18 19 |
# File 'lib/yard/markdown/documentation_helper.rb', line 13 def documented_text(object) text = rdoc_to_md(object.docstring) return text unless text.empty? return '' unless object..empty? 'Not documented.' end |
#rdoc_to_md(docstring) ⇒ String
Converts an RDoc-formatted docstring to Markdown.
25 26 27 |
# File 'lib/yard/markdown/documentation_helper.rb', line 25 def rdoc_to_md(docstring) RDoc::Markup::ToMarkdown.new.convert(docstring).rstrip end |