Results for: "OptionParser"

Returns an incremented value of default according to arg.

No documentation available

Initializes the instance and yields itself if called with a block.

banner

Banner message.

width

Summary width.

indent

Summary indent.

Directs to reject specified class argument.

t

Argument class specifier, any object including Class.

reject(t)

See reject.

No documentation available

Pushes a new List.

Removes the last List.

Returns option summary string.

Checks if an argument is given twice, in which case an ArgumentError is raised. Called from OptionParser#switch only.

obj

New argument.

prv

Previously specified argument.

msg

Exception message.

No documentation available

Traverses @stack, sending each element method id with args and block.

Completes shortened long style option switch and returns pair of canonical switch and switch descriptor OptionParser::Switch.

typ

Searching table.

opt

Searching key.

icase

Search case insensitive if true.

pat

Optional pattern for completion.

No documentation available

Loads options from file names as filename. Does nothing when the file is not present. Returns whether successfully loaded.

filename defaults to basename of the program without suffix in a directory ~/.options, then the basename with ‘.options’ suffix under XDG and Haiku standard places.

Add option switch like with on, but at head of summary.

Add option switch like with on, but at tail of summary.

No documentation available

Sets OptionParser object, when opt is false or nil, methods OptionParser::Arguable#options and OptionParser::Arguable#options= are undefined. Thus, there is no ways to access the OptionParser object via the receiver object.

Actual OptionParser object, automatically created if nonexistent.

If called with a block, yields the OptionParser object and returns the result of the block. If an OptionParser::ParseError exception occurs in the block, it is rescued, a error message printed to STDERR and nil returned.

Parses self destructively and returns self containing the rest arguments left unparsed.

No documentation available

Searches key in id list. The result is returned or yielded if a block is given. If it isn’t found, nil is returned.

No documentation available

Substitution of getopts is possible as follows. Also see OptionParser#getopts.

def getopts(*args)
  ($OPT = ARGV.getopts(*args)).each do |opt, val|
    eval "$OPT_#{opt.gsub(/[^A-Za-z0-9_]/, '_')} = val"
  end
rescue OptionParser::ParseError
end
Search took: 4ms  ·  Total Results: 4629