Class | Thor::Options |
In: |
lib/thor/options.rb
|
Parent: | Object |
NUMERIC | = | /(\d*\.\d+|\d+)/ |
LONG_RE | = | /^(--\w+[-\w+]*)$/ |
SHORT_RE | = | /^(-[a-z])$/i |
EQ_RE | = | /^(--\w+[-\w+]*|-[a-z])=(.*)$/i |
SHORT_SQ_RE | = | /^-([a-z]{2,})$/i |
SHORT_NUM | = | /^(-[a-z])#{NUMERIC}$/i |
leading_non_opts | [R] | |
trailing_non_opts | [R] |
Takes an array of switches. Each array consists of up to three elements that indicate the name and type of switch. Returns a hash containing each switch name, minus the ’-’, as a key. The value for each key depends on the type of switch and/or the value provided by the user.
The long switch must be provided. The short switch defaults to the first letter of the short switch. The default type is :boolean.
Example:
opts = Thor::Options.new( "--debug" => true, ["--verbose", "-v"] => true, ["--level", "-l"] => :numeric ).parse(args)