Class | Options |
In: |
options.rb
|
Parent: | Object |
all_one_file | [R] | should the output be placed into a single file |
charset | [R] | character-set |
css | [R] | URL of stylesheet |
diagram | [R] | should diagrams be drawn |
exclude | [RW] | files matching this pattern will be excluded |
extra_accessor_flags | [R] | |
extra_accessors | [R] | pattern for additional attr_... style methods |
fileboxes | [R] | should we draw fileboxes in diagrams |
files | [R] | and the list of files to be processed |
generator | [RW] | description of the output generator (set with the -fmt option |
ignore_case | [R] | The case of names of classes or modules or methods are ignored |
image_format | [R] | image format for diagrams |
include_line_numbers | [R] | include line numbers in the source listings |
inline_source | [R] | should source code be included inline, or displayed in a popup |
main_page | [RW] | name of the file, class or module to display in the initial index page (if not specified the first file we encounter is used) |
merge | [R] | merge into classes of the name name when generating ri |
op_dir | [RW] | the name of the output directory |
op_name | [R] | the name to use for the output |
promiscuous | [R] | Are we promiscuous about showing module contents across multiple files |
quiet | [R] | Don‘t display progress as we process the files |
rdoc_include | [R] | array of directories to search for files to satisfy an :include: |
show_all | [RW] | include private and protected methods in the output |
show_hash | [R] | include the ’#’ at the front of hyperlinked instance method names |
tab_width | [R] | the number of columns in a tab |
template | [R] | template to be used when generating output |
webcvs | [R] | URL of web cvs frontend |
Parse command line options. We‘re passed a hash containing output generators, keyed by the generator name
# File options.rb, line 349 349: def parse(argv, generators) 350: old_argv = ARGV.dup 351: begin 352: ARGV.replace(argv) 353: @op_dir = "doc" 354: @op_name = nil 355: @show_all = false 356: @main_page = nil 357: @marge = false 358: @exclude = [] 359: @quiet = false 360: @generator_name = 'html' 361: @generator = generators[@generator_name] 362: @rdoc_include = [] 363: @title = nil 364: @template = nil 365: @diagram = false 366: @fileboxes = false 367: @show_hash = false 368: @image_format = 'png' 369: @inline_source = false 370: @all_one_file = false 371: @tab_width = 8 372: @include_line_numbers = false 373: @extra_accessor_flags = {} 374: @promiscuous = false 375: @ignore_case = false 376: 377: @css = nil 378: @webcvs = nil 379: 380: @charset = case $KCODE 381: when /^S/i 382: 'Shift_JIS' 383: when /^E/i 384: 'EUC-JP' 385: else 386: 'iso-8859-1' 387: end 388: 389: accessors = [] 390: 391: go = GetoptLong.new(*OptionList.options) 392: go.quiet = true 393: 394: go.each do |opt, arg| 395: case opt 396: when "--all" then @show_all = true 397: when "--charset" then @charset = arg 398: when "--debug" then $DEBUG = true 399: when "--exclude" then @exclude << Regexp.new(arg) 400: when "--inline-source" then @inline_source = true 401: when "--line-numbers" then @include_line_numbers = true 402: when "--main" then @main_page = arg 403: when "--merge" then @merge = true 404: when "--one-file" then @all_one_file = @inline_source = true 405: when "--op" then @op_dir = arg 406: when "--opname" then @op_name = arg 407: when "--promiscuous" then @promiscuous = true 408: when "--quiet" then @quiet = true 409: when "--show-hash" then @show_hash = true 410: when "--style" then @css = arg 411: when "--template" then @template = arg 412: when "--title" then @title = arg 413: when "--webcvs" then @webcvs = arg 414: when "--ignore-case" then @ignore_case = true 415: 416: when "--accessor" 417: arg.split(/,/).each do |accessor| 418: if accessor =~ /^(\w+)(=(.*))?$/ 419: accessors << $1 420: @extra_accessor_flags[$1] = $3 421: end 422: end 423: 424: when "--diagram" 425: check_diagram 426: @diagram = true 427: 428: when "--fileboxes" 429: @fileboxes = true if @diagram 430: 431: when "--fmt" 432: @generator_name = arg.downcase 433: setup_generator(generators) 434: 435: when "--help" 436: OptionList.usage(generators.keys) 437: 438: when "--help-output" 439: OptionList.help_output 440: 441: when "--image-format" 442: if ['gif', 'png', 'jpeg', 'jpg'].include?(arg) 443: @image_format = arg 444: else 445: raise GetoptLong::InvalidOption.new("unknown image format: #{arg}") 446: end 447: 448: when "--include" 449: @rdoc_include.concat arg.split(/\s*,\s*/) 450: 451: when "--ri", "--ri-site", "--ri-system" 452: @generator_name = "ri" 453: @op_dir = case opt 454: when "--ri" then RI::Paths::HOMEDIR 455: when "--ri-site" then RI::Paths::SITEDIR 456: when "--ri-system" then RI::Paths::SYSDIR 457: else fail opt 458: end 459: setup_generator(generators) 460: 461: when "--tab-width" 462: begin 463: @tab_width = Integer(arg) 464: rescue 465: $stderr.puts "Invalid tab width: '#{arg}'" 466: exit 1 467: end 468: 469: when "--extension" 470: new, old = arg.split(/=/, 2) 471: OptionList.error("Invalid parameter to '-E'") unless new && old 472: unless RDoc::ParserFactory.alias_extension(old, new) 473: OptionList.error("Unknown extension .#{old} to -E") 474: end 475: 476: when "--version" 477: puts VERSION_STRING 478: exit 479: end 480: 481: end 482: 483: @files = ARGV.dup 484: 485: @rdoc_include << "." if @rdoc_include.empty? 486: 487: if @exclude.empty? 488: @exclude = nil 489: else 490: @exclude = Regexp.new(@exclude.join("|")) 491: end 492: 493: check_files 494: 495: # If no template was specified, use the default 496: # template for the output formatter 497: 498: @template ||= @generator_name 499: 500: # Generate a regexp from the accessors 501: unless accessors.empty? 502: re = '^(' + accessors.map{|a| Regexp.quote(a)}.join('|') + ')$' 503: @extra_accessors = Regexp.new(re) 504: end 505: 506: rescue GetoptLong::InvalidOption, GetoptLong::MissingArgument => error 507: OptionList.error(error.message) 508: 509: ensure 510: ARGV.replace(old_argv) 511: end 512: end