跳至内容 跳至搜索

封装一个正则表达式,该表达式将针对源文件的每个注释进行测试。

命名空间
方法
A

实例公共方法

annotations(file)

# 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