Class

OptionParser::Switch

Inheritance
< Object

Individual switch class. Not important to the user.

Defined within Switch are several Switch-derived classes: NoArgument, RequiredArgument, etc.

Attributes

Name Visibility R/W Description
arg public R
block public R
conv public R
desc public R
long public R
pattern public R
short public R

Methods

Class

Visibility Signature
public guess (arg)
public incompatible_argument_styles (arg, t)
public new (pattern = nil, conv = nil, short = nil, long = nil, arg = nil, desc = ([] if short or long), block = Proc.new)
public pattern ()

Instance

Visibility Signature
public summarize (sdone = [], ldone = [], width = 1, max = width - 1, indent = "") {|indent + l| ...}

Class Method Detail

guess(arg)

Guesses argument style from arg. Returns corresponding OptionParser::Switch class (OptionalArgument, etc.).

incompatible_argument_styles(arg, t)

new(pattern = nil, conv = nil, short = nil, long = nil, arg = nil, desc = ([] if short or long), block = Proc.new)

pattern()

Instance Method Detail

summarize(sdone = [], ldone = [], width = 1, max = width - 1, indent = "") {|indent + l| ...}

Produces the summary text. Each line of the summary is yielded to the block (without newline).

sdone:Already summarized short style options keyed hash.
ldone:Already summarized long style options keyed hash.
width:Width of left side (option part). In other words, the right side (description part) starts after width columns.
max:Maximum width of left side -> the options are filled within max columns.
indent:Prefix string indents all summarized lines.