Class: Gloo::Docs::DocData

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#childrenObject

Returns the value of attribute children.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def children
  @children
end

#descriptionObject

Returns the value of attribute description.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def description
  @description
end

#errorsObject

Returns the value of attribute errors.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def errors
  @errors
end

#examplesObject

Returns the value of attribute examples.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def examples
  @examples
end

#messagesObject

Returns the value of attribute messages.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def messages
  @messages
end

#nameObject

Returns the value of attribute name.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def name
  @name
end

#notesObject

Returns the value of attribute notes.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def notes
  @notes
end

#parametersObject

Returns the value of attribute parameters.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def parameters
  @parameters
end

#resultObject

Returns the value of attribute result.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def result
  @result
end

#shortcutObject

Returns the value of attribute shortcut.



27
28
29
# File 'lib/gloo/docs/doc_data.rb', line 27

def shortcut
  @shortcut
end

#syntaxObject

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

#renderObject

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
  add_messages buf
  add_result buf
  add_errors buf
  add_examples buf
  add_notes buf
  buf << "\n"
  return buf
end

#show_in_terminalObject

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