Class: Decode::Comment::Tag
Instance Attribute Summary collapse
-
#directive ⇒ Object
readonly
The directive that generated the tag.
Attributes inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(directive) ⇒ Tag
constructor
A new instance of Tag.
Methods inherited from Node
#add, #children?, #each, #filter, #text, #traverse
Constructor Details
#initialize(directive) ⇒ Tag
Returns a new instance of Tag.
30 31 32 |
# File 'lib/decode/comment/tag.rb', line 30 def initialize(directive) @directive = directive end |
Instance Attribute Details
#directive ⇒ Object (readonly)
The directive that generated the tag.
36 37 38 |
# File 'lib/decode/comment/tag.rb', line 36 def directive @directive end |
Class Method Details
.match(text) ⇒ Object
11 12 13 |
# File 'lib/decode/comment/tag.rb', line 11 def self.match(text) self::PATTERN.match(text) end |
.parse(directive, text, lines, tags, level = 0) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/decode/comment/tag.rb', line 15 def self.parse(directive, text, lines, , level = 0) if match = self.match(text) node = self.build(directive, match) .parse(lines, level + 1) do |child| node.add(child) end return node else # Consume all nested nodes: .ignore(lines, level + 1) end end |