Class Thor::Options
In: lib/thor/options.rb
Parent: Object

Methods

formatted_usage   new   non_opts   parse   to_s  

Classes and Modules

Class Thor::Options::Error
Class Thor::Options::Hash

Constants

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

Attributes

leading_non_opts  [R] 
trailing_non_opts  [R] 

Public Class methods

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)

Public Instance methods

to_s()

Alias for formatted_usage

[Validate]