Class: AsciidoctorVaped::Parser::Blocks::BaseNode
- Inherits:
-
Object
- Object
- AsciidoctorVaped::Parser::Blocks::BaseNode
- Defined in:
- lib/asciidoctor_vaped/parser/blocks/common/base_node.rb
Direct Known Subclasses
Admonition, BlankLine, Caption, Comment, DelimitedNode, DocumentAttribute, ElementAttributes, Heading, ListBase, ListItem, Paragraph
Instance Method Summary collapse
- #handle(context) ⇒ Object
-
#initialize(successor = nil) ⇒ BaseNode
constructor
A new instance of BaseNode.
- #match?(context) ⇒ Boolean
Constructor Details
#initialize(successor = nil) ⇒ BaseNode
Returns a new instance of BaseNode.
7 8 9 |
# File 'lib/asciidoctor_vaped/parser/blocks/common/base_node.rb', line 7 def initialize(successor = nil) @successor = successor end |
Instance Method Details
#handle(context) ⇒ Object
11 12 13 14 15 |
# File 'lib/asciidoctor_vaped/parser/blocks/common/base_node.rb', line 11 def handle(context) return parse(context) if match?(context) @successor&.handle(context) end |
#match?(context) ⇒ Boolean
17 18 19 |
# File 'lib/asciidoctor_vaped/parser/blocks/common/base_node.rb', line 17 def match?(context) context.reader.peek&.match?(self.class::PATTERN) end |