Class MSpecOptions
In: lib/mspec/utils/options.rb
Parent: Object

MSpecOptions provides a parser for command line options. It also provides a composable set of options from which the runner scripts can select for their particular functionality.

Methods

action_filters   actions   add   background   chdir   configure   debug   doc   filters   formatters   help   interrupt   match?   name   new   on   on_extra   parse   prefix   pretend   process   randomize   split   targets   to_s   unguarded   verbose   verify   version  

Classes and Modules

Class MSpecOptions::OptionError
Class MSpecOptions::ParseError

Attributes

banner  [RW] 
config  [RW] 
options  [RW] 
width  [RW] 

Public Class methods

Public Instance methods

Adds documentation text for an option and adds an MSpecOption instance to the list of registered options.

The methods below provide groups of options that are composed by the particular runners to provide their functionality

Adds a string of documentation text inline in the text generated from the options. See on and add.

Convenience method for providing -h, —help options.

Searches all registered options to find a match for opt. Returns nil if no registered options match.

Registers an option. Acceptable formats for arguments are:

 on "-a", "description"
 on "-a", "--abdc", "description"
 on "-a", "ARG", "description"
 on "--abdc", "ARG", "description"
 on "-a", "--abdc", "ARG", "description"

If an block is passed, it will be invoked when the option is matched. Not passing a block is permitted, but nonsensical.

Stores a block that will be called with unrecognized options

Parses an array of command line entries, calling blocks for registered options.

Processes an option. Calles the on_extra block (or default) for unrecognized options. For registered options, possibly fetches an argument and invokes the option‘s block if it is not nil.

Splits a string at n characters into the opt and the rest. The arg is set to nil if rest is an empty string.

Returns a string representation of the options and doc strings.

Convenience method for providing -v, —version options.

[Validate]