Class: Rails::SourceAnnotationExtractor::ParserExtractor
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Inherits: |
Struct
|
Defined in: | railties/lib/rails/source_annotation_extractor.rb |
Overview
Wraps a regular expression that will be tested against each of the source file’s comments.
Instance Attribute Summary
-
#pattern
rw
Wraps a regular expression that will be tested against each of the source file’s comments.
Instance Method Summary
-
#annotations(file)
See additional method definition at line 26.
Instance Attribute Details
#pattern (rw)
Wraps a regular expression that will be tested against each of the source file’s comments.
Instance Method Details
#annotations(file)
See additional method definition at line 26.
# File 'railties/lib/rails/source_annotation_extractor.rb', line 49
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