Class: Decode::Documentation

Inherits:
Comment::Node show all
Defined in:
lib/decode/documentation.rb

Overview

Structured access to a set of comment lines.

Instance Attribute Summary collapse

Attributes inherited from Comment::Node

#children

Instance Method Summary collapse

Methods inherited from Comment::Node

#add, #children?, #each, #text, #traverse

Constructor Details

#initialize(comments, language = nil) ⇒ Documentation

Initialize the documentation with an array of comments, within a specific language.



38
39
40
41
42
43
44
45
# File 'lib/decode/documentation.rb', line 38

def initialize(comments, language = nil)
  @comments = comments
  @language = language
  
  language.tags.parse(@comments.dup) do |node|
    self.add(node)
  end
end

Instance Attribute Details

#commentsObject (readonly)

The underlying comments from which the documentation is extracted.



49
50
51
# File 'lib/decode/documentation.rb', line 49

def comments
  @comments
end

#languageObject (readonly)

The language in which the documentation was extracted from.



53
54
55
# File 'lib/decode/documentation.rb', line 53

def language
  @language
end