Class: Yard::Lint::Parsers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/yard/lint/parsers/base.rb

Overview

Base class used for all the subparsers of a yard parser

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.regexpsObject

Returns the value of attribute regexps.



10
11
12
# File 'lib/yard/lint/parsers/base.rb', line 10

def regexps
  @regexps
end

Instance Method Details

#match(string, regexp_name) ⇒ Array<String>

Returns array with extracted details or empty array if there’s nothing worth extracting.

Parameters:

  • string (String)

    string from which we want to extract informations

  • regexp_name (Symbol)

    name of a regexp used to extract a given information

Returns:

  • (Array<String>)

    array with extracted details or empty array if there’s nothing worth extracting



17
18
19
# File 'lib/yard/lint/parsers/base.rb', line 17

def match(string, regexp_name)
  string.match(self.class.regexps[regexp_name])&.captures || []
end