Class: DocumentationList
- Inherits:
-
Object
- Object
- DocumentationList
- Defined in:
- lib/model/documentation_list.rb
Instance Attribute Summary collapse
-
#end_index ⇒ Object
readonly
Returns the value of attribute end_index.
-
#start_index ⇒ Object
readonly
Returns the value of attribute start_index.
Instance Method Summary collapse
-
#initialize(tokens, start_index, end_index) ⇒ DocumentationList
constructor
A new instance of DocumentationList.
- #parameter_documentation_list ⇒ Object
Constructor Details
#initialize(tokens, start_index, end_index) ⇒ DocumentationList
Returns a new instance of DocumentationList.
6 7 8 |
# File 'lib/model/documentation_list.rb', line 6 def initialize(tokens, start_index, end_index) @tokens, @start_index, @end_index = tokens, start_index, end_index end |
Instance Attribute Details
#end_index ⇒ Object (readonly)
Returns the value of attribute end_index.
4 5 6 |
# File 'lib/model/documentation_list.rb', line 4 def end_index @end_index end |
#start_index ⇒ Object (readonly)
Returns the value of attribute start_index.
4 5 6 |
# File 'lib/model/documentation_list.rb', line 4 def start_index @start_index end |
Instance Method Details
#parameter_documentation_list ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/model/documentation_list.rb', line 10 def parameter_documentation_list return @parameter_documentation_list unless @parameter_documentation_list.nil? parameter_documentation = ParameterDocumentation.new harvest_tokens = false @parameter_documentation_list = @tokens.inject([]) do |memo, token| if token.type == :COMMENT && token.value.match(/@param \w*/) memo << parameter_documentation if parameter_documentation.tokens.any? parameter_documentation = ParameterDocumentation.new harvest_tokens = true end if (token.type == :COMMENT && token.value.strip == "") harvest_tokens = false end if harvest_tokens parameter_documentation.tokens << token end memo end @parameter_documentation_list << parameter_documentation if parameter_documentation.tokens.any? @parameter_documentation_list end |