- Inheritance
- < Object
Simple option list providing mapping from short and/or long option string to OptionParser::Switch and mapping from acceptable argument to matching pattern and converter pair. Also provides summary feature.
Attributes
Name | Visibility | R/W | Description |
---|---|---|---|
atype | public | R | Map from acceptable argument types to pattern and converter pairs. |
list | public | R | List of all switches and summary string. |
long | public | R | Map from long style option switches to actual switch objects. |
short | public | R | Map from short style option switches to actual switch objects. |
Methods
Class
Visibility | Signature |
---|---|
public | new () |
Instance
Visibility | Signature |
---|---|
public | accept (t, pat = /.*/nm, &block) |
public | append (*args) |
public | complete (id, opt, icase = false, *pat, &block) |
public | each_option (&block) |
public | prepend (*args) |
public | reject (t) |
public | search (id, key) {|val| ...} |
public | summarize (*args) {|""| ...} |
Class Method Detail
new()
Just initializes all instance variables.
Instance Method Detail
accept(t, pat = /.*/nm, &block)
See OptionParser.accept.
append(*args)
Appends switch at the tail of the list, and associates short, long and negated long options. Arguments are:
switch: | OptionParser::Switch instance to be inserted. |
short_opts: | List of short style options. |
long_opts: | List of long style options. |
nolong_opts: | List of long style options with "no-" prefix. |
append(switch, short_opts, long_opts, nolong_opts)
complete(id, opt, icase = false, *pat, &block)
Searches list id for opt and the optional patterns for completion pat. If icase is true, the search is case insensitive. The result is returned or yielded if a block is given. If it isn‘t found, nil is returned.
each_option(&block)
Iterates over each option, passing the option to the block.
prepend(*args)
Inserts switch at the head of the list, and associates short, long and negated long options. Arguments are:
switch: | OptionParser::Switch instance to be inserted. |
short_opts: | List of short style options. |
long_opts: | List of long style options. |
nolong_opts: | List of long style options with "no-" prefix. |
prepend(switch, short_opts, long_opts, nolong_opts)
reject(t)
See OptionParser.reject.
search(id, key) {|val| ...}
Searches key in id list. The result is returned or yielded if a block is given. If it isn‘t found, nil is returned.
summarize(*args) {|""| ...}
Creates the summary table, passing each line to the block (without newline). The arguments args are passed along to the summarize method which is called on every option.