封装一个正则表达式,该表达式将针对源文件的每个注释进行测试。
命名空间
方法
- A
实例公共方法
annotations(file) 链接
来源:显示 | 在 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