Object
A TAGS file generator based on ctags.sourceforge.net/FORMAT
This file will be automatically loaded via rdoc/discover.rb. If you wish to load this standalone, require ‘rdoc/rdoc’ first.
The version of the tags generator you are using
Creates a new tags generator
# File lib/rdoc/generator/tags.rb, line 98 def initialize options @options = options @ctags_merge = options.ctags_merge @ctags_path = options.ctags_path @dry_run = options.dry_run @tags = Hash.new { |h, name| h[name] = [] } end
Adds tags-generator options to the RDoc::Options instance options
# File lib/rdoc/generator/tags.rb, line 56 def self.setup_options options options.force_output = true options.op_dir = '.' options.update_output_dir = false options.extend Options options.tag_style = :vim op = options.option_parser op.separator nil op.separator 'tags generator options:' op.separator nil op.on('--[no-]ctags-merge', 'Merge exuberant ctags with our own?', 'Use this for projects with C extensions') do |value| options.ctags_path = value end op.separator nil op.on('--ctags-path=PATH', 'Path to Exuberant Ctags', 'This will be auto-discovered from PATH') do |value| options.ctags_path = value end op.separator nil op.on('--tag-style=TAG_STYLE', Options::TAG_STYLES, 'Which type of TAGS file to output') do |value| options.tag_style = value end op.separator nil end
Generates a TAGS file from top_levels
# File lib/rdoc/generator/tags.rb, line 131 def generate top_levels top_levels.each do |top_level| @tags[top_level.relative_name] << [top_level.relative_name, 0, 'F'] end RDoc::TopLevel.all_classes_and_modules.each do |klass| kind = "class:#{klass.full_name}" address = unless RDoc::TopLevel === klass.parent then "/#{klass.type} \\(#{klass.parent.full_name}::\\)\\?#{klass.name}/" else "/#{klass.type} #{klass.full_name}/" end klass.in_files.each do |file| @tags[klass.full_name] << [file.relative_name, address, 'c'] @tags[klass.name] << [file.relative_name, address, 'c'] end klass.each_attribute do |attr| where = [ attr.file.relative_name, "/attr\\w\\*\\s\\*\\[:'\"]#{attr.name}/", 'f', kind ] @tags[attr.name] << where @tags["#{attr.name}="] << where end klass.each_constant do |constant| @tags[constant.name] << [ constant.file.relative_name, "/#{constant.name}\\s\\*=/", 'd', kind] end klass.each_method do |method| address = if method.singleton then # \w doesn't appear to work in [] with nomagic "/def \\[A-Za-z0-9_:]\\+.#{method.name}/" else "/def #{method.name}/" end @tags[method.name] << [ method.file.relative_name, address, 'f', kind] end end unless @dry_run then write_tags merge_ctags end end
Generated with the Darkfish Rdoc Generator 2.