Class: Gloo::Docs::DocData
- Inherits:
-
Object
- Object
- Gloo::Docs::DocData
- Defined in:
- lib/gloo/docs/doc_data.rb
Constant Summary collapse
- DESCRIPTION =
'## Description'.freeze
- SYNTAX =
'## Syntax'.freeze
- PARAMETERS =
'## Parameters'.freeze
- CHILDREN =
'## Children'.freeze
- MESSAGES =
'## Messages'.freeze
- RESULT =
'## Result'.freeze
- ERRORS =
'## Errors'.freeze
- EXAMPLES =
'## Examples'.freeze
- NOTES =
'## Notes'.freeze
- FENCE =
'```gloo'.freeze
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#description ⇒ Object
Returns the value of attribute description.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#examples ⇒ Object
Returns the value of attribute examples.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#result ⇒ Object
Returns the value of attribute result.
-
#shortcut ⇒ Object
Returns the value of attribute shortcut.
-
#syntax ⇒ Object
Returns the value of attribute syntax.
Instance Method Summary collapse
-
#initialize(value_hash) ⇒ DocData
constructor
A new instance of DocData.
-
#render ⇒ Object
Render the documentation as a markdown string.
-
#show_in_terminal ⇒ Object
Show the documentation in the terminal.
Constructor Details
#initialize(value_hash) ⇒ DocData
Returns a new instance of DocData.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gloo/docs/doc_data.rb', line 31 def initialize( value_hash ) @name = value_hash[:name] @shortcut = value_hash[:shortcut] @description = value_hash[:description] @syntax = value_hash[:syntax] @parameters = value_hash[:parameters] @children = value_hash[:children] @messages = value_hash[:messages] @result = value_hash[:result] @errors = value_hash[:errors] @examples = value_hash[:examples] @notes = value_hash[:notes] end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def children @children end |
#description ⇒ Object
Returns the value of attribute description.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def description @description end |
#errors ⇒ Object
Returns the value of attribute errors.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def errors @errors end |
#examples ⇒ Object
Returns the value of attribute examples.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def examples @examples end |
#messages ⇒ Object
Returns the value of attribute messages.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def @messages end |
#name ⇒ Object
Returns the value of attribute name.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def name @name end |
#notes ⇒ Object
Returns the value of attribute notes.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def notes @notes end |
#parameters ⇒ Object
Returns the value of attribute parameters.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def parameters @parameters end |
#result ⇒ Object
Returns the value of attribute result.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def result @result end |
#shortcut ⇒ Object
Returns the value of attribute shortcut.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def shortcut @shortcut end |
#syntax ⇒ Object
Returns the value of attribute syntax.
27 28 29 |
# File 'lib/gloo/docs/doc_data.rb', line 27 def syntax @syntax end |
Instance Method Details
#render ⇒ Object
Render the documentation as a markdown string.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/gloo/docs/doc_data.rb', line 47 def render buf = +'' add_name buf add_description buf add_syntax buf add_parameters buf add_children buf buf add_result buf add_errors buf add_examples buf add_notes buf buf << "\n" return buf end |
#show_in_terminal ⇒ Object
Show the documentation in the terminal.
65 66 67 |
# File 'lib/gloo/docs/doc_data.rb', line 65 def show_in_terminal puts render end |