Class: FrontMatterParser::SyntaxParser::IndentationComment

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Factorizable

[]

Constructor Details

#initializeIndentationComment

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

#regexpObject (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

.delimitersObject

:nocov:

Raises:

  • (NotImplementedError)

See Also:



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