Class: Decode::Comment::Tag

Inherits:
Node
  • Object
show all
Defined in:
lib/decode/comment/tag.rb

Direct Known Subclasses

Attribute, Parameter, Pragma, Yields

Instance Attribute Summary collapse

Attributes inherited from Node

#children

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

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

Constructor Details

#initialize(directive) ⇒ Tag

Returns a new instance of Tag.



41
42
43
# File 'lib/decode/comment/tag.rb', line 41

def initialize(directive)
	@directive = directive
end

Instance Attribute Details

#directiveObject (readonly)

The directive that generated the tag.



47
48
49
# File 'lib/decode/comment/tag.rb', line 47

def directive
  @directive
end

Class Method Details

.parse(directive, text, lines, tags, level = 0) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/decode/comment/tag.rb', line 26

def self.parse(directive, text, lines, tags, level = 0)
	if match = self::PATTERN.match(text)
		node = self.build(directive, match)
		
		tags.parse(lines, level + 1) do |child|
			node.add(child)
		end
		
		return node
	else
		# Consume all nested nodes:
		tags.ignore(lines, level + 1)
	end
end