Class: FrontMatterParser::SyntaxParser::IndentationComment
- Inherits:
-
Object
- Object
- FrontMatterParser::SyntaxParser::IndentationComment
- Extended by:
- Factorizable
- Defined in:
- lib/front_matter_parser/syntax_parser/indentation_comment.rb
Overview
Parser for syntaxes which use comments ended by indentation
Instance Attribute Summary collapse
-
#regexp ⇒ Object
readonly
A regexp that returns two groups: front_matter and content.
Class Method Summary collapse
-
.delimiters ⇒ Object
:nocov:.
Instance Method Summary collapse
- #call(string) ⇒ Object
-
#initialize ⇒ IndentationComment
constructor
A new instance of IndentationComment.
Methods included from Factorizable
Constructor Details
#initialize ⇒ IndentationComment
Returns a new instance of IndentationComment.
13 14 15 |
# File 'lib/front_matter_parser/syntax_parser/indentation_comment.rb', line 13 def initialize @regexp = build_regexp(*self.class.delimiters) end |
Instance Attribute Details
#regexp ⇒ Object (readonly)
A regexp that returns two groups: front_matter and content
11 12 13 |
# File 'lib/front_matter_parser/syntax_parser/indentation_comment.rb', line 11 def regexp @regexp end |
Class Method Details
.delimiters ⇒ Object
:nocov:
24 25 26 |
# File 'lib/front_matter_parser/syntax_parser/indentation_comment.rb', line 24 def self.delimiters raise NotImplementedError end |
Instance Method Details
#call(string) ⇒ Object
18 19 20 |
# File 'lib/front_matter_parser/syntax_parser/indentation_comment.rb', line 18 def call(string) string.match(regexp) end |