未验证 提交 5fd7ac79 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #32403 from albertoalmagro/improve-source-annotation-comments

[ci skip] Improve Rails::SourceAnnotationExtractor documentation
......@@ -29,7 +29,7 @@ def self.directories
end
# Registers additional directories to be included
# SourceAnnotationExtractor::Annotation.register_directories("spec", "another")
# Rails::SourceAnnotationExtractor::Annotation.register_directories("spec", "another")
def self.register_directories(*dirs)
directories.push(*dirs)
end
......@@ -39,7 +39,7 @@ def self.extensions
end
# Registers new Annotations File Extensions
# SourceAnnotationExtractor::Annotation.register_extensions("css", "scss", "sass", "less", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }
# Rails::SourceAnnotationExtractor::Annotation.register_extensions("css", "scss", "sass", "less", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }
def self.register_extensions(*exts, &block)
extensions[/\.(#{exts.join("|")})$/] = block
end
......@@ -69,7 +69,7 @@ def to_s(options = {})
#
# Directories may also be explicitly set using the <tt>:dirs</tt> key in +options+.
#
# SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true
# Rails::SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true
#
# If +options+ has a <tt>:tag</tt> flag, it will be passed to each annotation's +to_s+.
#
......@@ -95,9 +95,9 @@ def find(dirs)
end
# Returns a hash that maps filenames under +dir+ (recursively) to arrays
# with their annotations. Only files with annotations are included. Files
# with extension +.builder+, +.rb+, +.rake+, +.yml+, +.yaml+, +.ruby+,
# +.css+, +.js+ and +.erb+ are taken into account.
# with their annotations. Files with extensions registered in
# <tt>Rails::SourceAnnotationExtractor::Annotation.extensions</tt> are
# taken into account. Only files with annotations are included.
def find_in(dir)
results = {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册