Skip to Content Skip to Search

class Rails::SourceAnnotationExtractor::ParserExtractor

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

Inherits From

Public instance methods

Source code GitHub
# File railties/lib/rails/source_annotation_extractor.rb, line 26
def annotations(file)
  result = Prism.parse_file(file)
  return [] unless result.success?

  result.comments.filter_map do |comment|
    Annotation.new(comment.location.start_line, $1, $2) if comment.location.slice =~ pattern
  end
end

Namespace

Definition files