Wraps a regular expression that will iterate through a file’s lines and test each one for the given pattern.

Methods

Instance Public methods

annotations(file)

📝 Source code
# File railties/lib/rails/source_annotation_extractor.rb, line 43
      def annotations(file)
        lineno = 0

        File.readlines(file, encoding: Encoding::BINARY).inject([]) do |list, line|
          lineno += 1
          next list unless line =~ pattern
          list << Annotation.new(lineno, $1, $2)
        end
      end
🔎 See on GitHub