The options to support are passed to new() as an array of arrays. Each
sub-array contains any number of String option
names which carry the same meaning, and one of the following flags:
GetoptLong::NO_ARGUMENT :
Option does not take an argument.
GetoptLong::REQUIRED_ARGUMENT :
Option always takes an argument.
GetoptLong::OPTIONAL_ARGUMENT :
Option may or may not take an argument.
The first option name is considered to be the preferred (canonical) name.
Other than that, the elements of each
sub-array can be in any order.
# File lib/getoptlong.rb, line 135
def initialize(*arguments)
#
# Current ordering.
#
if ENV.include?('POSIXLY_CORRECT')
@ordering = REQUIRE_ORDER
else
@ordering = PERMUTE
end
#
# Hash table of option names.
# Keys of the table are option names, and their values are canonical
# names of the options.
#
@canonical_names = Hash.new
#
# Hash table of argument flags.
# Keys of the table are option names, and their values are argument
# flags of the options.
#
@argument_flags = Hash.new
#
# Whether error messages are output to $deferr.
#
@quiet = FALSE
#
# Status code.
#
@status = STATUS_YET
#
# Error code.
#
@error = nil
#
# Error message.
#
@error_message = nil
#
# Rest of catenated short options.
#
@rest_singles = ''
#
# List of non-option-arguments.
# Append them to ARGV when option processing is terminated.
#
@non_option_arguments = Array.new
if 0 < arguments.length
set_options(*arguments)
end
end