Class: PointBlank::Parsing::ATXParser Abstract
- Inherits:
-
NullParser
- Object
- NullParser
- PointBlank::Parsing::ATXParser
- Defined in:
- lib/mmmd/blankshell.rb
Overview
This class is abstract.
ATX heading
Direct Known Subclasses
ATXParserLV1, ATXParserLV2, ATXParserLV3, ATXParserLV4, ATXParserLV5, ATXParserLV6
Class Attribute Summary collapse
-
.level ⇒ Object
Returns the value of attribute level.
Class Method Summary collapse
Instance Method Summary collapse
-
#consume(line, _parent, **_hargs) ⇒ Array(String, Boolean)
Consume line markers.
-
#initialize ⇒ ATXParser
constructor
A new instance of ATXParser.
Methods inherited from NullParser
Constructor Details
#initialize ⇒ ATXParser
Returns a new instance of ATXParser.
420 421 422 423 |
# File 'lib/mmmd/blankshell.rb', line 420 def initialize super @matched = false end |
Class Attribute Details
.level ⇒ Object
Returns the value of attribute level.
412 413 414 |
# File 'lib/mmmd/blankshell.rb', line 412 def level @level end |
Class Method Details
.begin?(line) ⇒ Boolean
415 416 417 |
# File 'lib/mmmd/blankshell.rb', line 415 def begin?(line) line.match?(/^ {0,3}\#{#{@level}}(?: .*|)$/) end |
Instance Method Details
#consume(line, _parent, **_hargs) ⇒ Array(String, Boolean)
Consume line markers
426 427 428 429 430 431 432 433 434 |
# File 'lib/mmmd/blankshell.rb', line 426 def consume(line, _parent, **_hargs) return [nil, false] if @matched @matched = true push(line .gsub(/\A {0,3}\#{#{self.class.level}} */, '') .gsub(/( #+|)\Z/, '')) [line, false] end |