Skip to Content Skip to Search
v7.1.0
class Rails::SourceAnnotationExtractor::ParserExtractor < Struct.new(:pattern)

Rails::SourceAnnotationExtractor::ParserExtractor

Wraps a regular expression that will be tested against each of the source file’s comments.

Methods
A

Public instance methods

annotations(file)

Permalink
Source code GitHub
# File railties/lib/rails/source_annotation_extractor.rb, line 33
def annotations(file)
  contents = File.read(file, encoding: Encoding::BINARY)
  parser = Parser.new(contents, pattern: pattern).tap(&:parse)
  parser.error? ? [] : parser.comments
end
Namespace
Definition files