method
parse

Ruby latest stable (v2_5_5)
-
0 notes -
Class: Options
- 1_8_6_287 (0)
- 1_8_7_72 (0)
- 1_8_7_330 (0)
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
Related methods
- Instance methods (7)
-
check_diagram
(<= v1_8_7_330)
-
check_files
(<= v1_8_7_330)
-
error
(<= v1_8_7_330)
-
parse (<= v1_8_7_330)
-
setup_generator
(<= v1_8_7_330)
-
title (<= v1_8_7_330)
-
title= (<= v1_8_7_330)
= private
= protected
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.
These similar methods exist in v2_5_5:
- Time#parse
- CGI::Cookie#parse
- CSV#parse
- Date#parse
- DateTime#parse
- Net::IMAP::ResponseParser#parse
- URI#parse
- REXML::XPathParser#parse
- REXML::Parsers::TreeParser#parse
- REXML::Parsers::SAX2Parser#parse
- REXML::Parsers::StreamParser#parse
- REXML::Parsers::XPathParser#parse
- REXML::Parsers::UltraLightParser#parse
- REXML::Parsers::LightParser#parse
- REXML::DTD::Parser#parse
- RSS::Parser#parse
- RSS::BaseParser#parse
- WEBrick::HTTPRequest#parse
- WEBrick::Cookie#parse
- Net::SMTP::Response#parse
- RSS::ITunesItemModel::ITunesDuration#parse
- RSS::Utils::CSV#parse
- RSS::Utils::YesOther#parse
- JSON::Ext::Parser#parse
- OpenSSL::Config#parse
- OptionParser#parse
- OptionParser::Switch::NoArgument#parse
- OptionParser::Switch::OptionalArgument#parse
- OptionParser::Switch::PlacedArgument#parse
- OptionParser::Switch::RequiredArgument#parse
- RDoc::Options#parse
- Ripper#parse
- Ripper::Filter#parse
- Ripper::Lexer#parse
- JSON#parse
- RDoc::Text#parse
- Gem::Requirement#parse
- OpenSSL::X509::Name#parse
- Psych::Parser#parse
- RDoc::ClassModule#parse
- Psych#parse
- CGI#parse
- RDoc::Comment#parse
- RDoc::Markdown#parse
- RDoc::Markdown#parse
- RDoc::Markup#parse
- RDoc::RD#parse
- RDoc::TomDoc#parse
- URI::RFC2396_Parser#parse
- URI::RFC3986_Parser#parse
- Gem::RequestSet::Lockfile::Parser#parse
- Ripper#parse
- RSS::Utils::ExplicitCleanOther#parse
parse(argv, generators)
public
Parse command line options. We’re passed a hash containing output generators, keyed by the generator name
Show source
# File lib/rdoc/options.rb, line 349 def parse(argv, generators) old_argv = ARGV.dup begin ARGV.replace(argv) @op_dir = "doc" @op_name = nil @show_all = false @main_page = nil @marge = false @exclude = [] @quiet = false @generator_name = 'html' @generator = generators[@generator_name] @rdoc_include = [] @title = nil @template = nil @diagram = false @fileboxes = false @show_hash = false @image_format = 'png' @inline_source = false @all_one_file = false @tab_width = 8 @include_line_numbers = false @extra_accessor_flags = {} @promiscuous = false @force_update = false @css = nil @webcvs = nil @charset = case $KCODE when /^S/i 'Shift_JIS' when /^E/i 'EUC-JP' else 'iso-8859-1' end accessors = [] go = GetoptLong.new(*OptionList.options) go.quiet = true go.each do |opt, arg| case opt when "--all" then @show_all = true when "--charset" then @charset = arg when "--debug" then $DEBUG = true when "--exclude" then @exclude << Regexp.new(arg) when "--inline-source" then @inline_source = true when "--line-numbers" then @include_line_numbers = true when "--main" then @main_page = arg when "--merge" then @merge = true when "--one-file" then @all_one_file = @inline_source = true when "--op" then @op_dir = arg when "--opname" then @op_name = arg when "--promiscuous" then @promiscuous = true when "--quiet" then @quiet = true when "--show-hash" then @show_hash = true when "--style" then @css = arg when "--template" then @template = arg when "--title" then @title = arg when "--webcvs" then @webcvs = arg when "--accessor" arg.split(/,/).each do |accessor| if accessor =~ /^(\w+)(=(.*))?$/ accessors << $1 @extra_accessor_flags[$1] = $3 end end when "--diagram" check_diagram @diagram = true when "--fileboxes" @fileboxes = true if @diagram when "--fmt" @generator_name = arg.downcase setup_generator(generators) when "--help" OptionList.usage(generators.keys) when "--help-output" OptionList.help_output when "--image-format" if ['gif', 'png', 'jpeg', 'jpg'].include?(arg) @image_format = arg else raise GetoptLong::InvalidOption.new("unknown image format: #{arg}") end when "--include" @rdoc_include.concat arg.split(/\s*,\s*/) when "--ri", "--ri-site", "--ri-system" @generator_name = "ri" @op_dir = case opt when "--ri" then RI::Paths::HOMEDIR when "--ri-site" then RI::Paths::SITEDIR when "--ri-system" then RI::Paths::SYSDIR else fail opt end setup_generator(generators) when "--tab-width" begin @tab_width = Integer(arg) rescue $stderr.puts "Invalid tab width: '#{arg}'" exit 1 end when "--extension" new, old = arg.split(/=/, 2) OptionList.error("Invalid parameter to '-E'") unless new && old unless RDoc::ParserFactory.alias_extension(old, new) OptionList.error("Unknown extension .#{old} to -E") end when "--force-update" @force_update = true when "--version" puts VERSION_STRING exit end end @files = ARGV.dup @rdoc_include << "." if @rdoc_include.empty? if @exclude.empty? @exclude = nil else @exclude = Regexp.new(@exclude.join("|")) end check_files # If no template was specified, use the default # template for the output formatter @template ||= @generator_name # Generate a regexp from the accessors unless accessors.empty? re = '^(' + accessors.map{|a| Regexp.quote(a)}.join('|') + ')$' @extra_accessors = Regexp.new(re) end rescue GetoptLong::InvalidOption, GetoptLong::MissingArgument => error OptionList.error(error.message) ensure ARGV.replace(old_argv) end end