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

Direct Known Subclasses

OneLineBase, TwoLineBase, Validators::Documentation::BlankLineBeforeDefinition::Parser, Validators::Documentation::DuplicateNamespaceComment::Parser, Validators::Documentation::EmptyCommentLine::Parser, Validators::Documentation::LineLength::Parser, Validators::Documentation::MarkdownSyntax::Parser, Validators::Documentation::MissingReturn::Parser, Validators::Documentation::OrphanedDocComment::Parser, Validators::Documentation::TextSubstitution::Parser, Validators::Documentation::UnderfilledLines::Parser, Validators::Documentation::UndocumentedBooleanMethods::Parser, Validators::Documentation::UndocumentedMethodArguments::Parser, Validators::Documentation::UndocumentedObjects::Parser, Validators::Documentation::UndocumentedOptions::Parser, Validators::Semantic::AbstractMethods::Parser, Validators::Tags::ApiTags::Parser, Validators::Tags::CollectionType::Parser, Validators::Tags::ExampleStyle::Parser, Validators::Tags::ExampleSyntax::Parser, Validators::Tags::ForbiddenTags::Parser, Validators::Tags::InformalNotation::Parser, Validators::Tags::InvalidTypes::Parser, Validators::Tags::MeaninglessTag::Parser, Validators::Tags::MissingYield::Parser, Validators::Tags::NonAsciiType::Parser, Validators::Tags::OptionTags::Parser, Validators::Tags::Order::Parser, Validators::Tags::RedundantParamDescription::Parser, Validators::Tags::TagGroupSeparator::Parser, Validators::Tags::TagSeparator::Parser, Validators::Tags::TagTypePosition::Parser, Validators::Tags::TypeSyntax::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