Namespace

Class Index [+]

Quicksearch

Thor::Base

Attributes

options[RW]

Public Class Methods

new(args=[], options={}, config={}) click to toggle source

It receives arguments in an Array and two hashes, one for options and other for configuration.

Notice that it does not check if all required arguments were supplied. It should be done by the parser.

Parameters

args

An array of objects. The objects are applied to their respective accessors declared with argument.

options

An options hash that will be available as self.options. The hash given is converted to a hash with indifferent access, magic predicates (options.skip?) and then frozen.

config

Configuration for this Thor class.

    # File lib/bundler/vendor/thor/base.rb, line 40
40:     def initialize(args=[], options={}, config={})
41:       args = Thor::Arguments.parse(self.class.arguments, args)
42:       args.each { |key, value| send("#{key}=", value) }
43: 
44:       parse_options = self.class.class_options
45: 
46:       if options.is_a?(Array)
47:         task_options  = config.delete(:task_options) # hook for start
48:         parse_options = parse_options.merge(task_options) if task_options
49:         array_options, hash_options = options, {}
50:       else
51:         array_options, hash_options = [], options
52:       end
53: 
54:       opts = Thor::Options.new(parse_options, hash_options)
55:       self.options = opts.parse(array_options)
56:       opts.check_unknown! if self.class.check_unknown_options?(config)
57:     end
shell() click to toggle source

Returns the shell used in all Thor classes. If you are in a Unix platform it will use a colored log, otherwise it will use a basic one without color.

    # File lib/bundler/vendor/thor/shell.rb, line 8
 8:     def self.shell
 9:       @shell ||= if ENV['THOR_SHELL'] && ENV['THOR_SHELL'].size > 0
10:         Thor::Shell.const_get(ENV['THOR_SHELL'])
11:       elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
12:         Thor::Shell::Basic
13:       else
14:         Thor::Shell::Color
15:       end
16:     end
shell=(klass) click to toggle source

Sets the shell used in all Thor classes.

    # File lib/bundler/vendor/thor/shell.rb, line 20
20:     def self.shell=(klass)
21:       @shell = klass
22:     end
subclass_files() click to toggle source

Returns the files where the subclasses are kept.

Returns

Hash[path => Class]

    # File lib/bundler/vendor/thor/base.rb, line 80
80:       def subclass_files
81:         @subclass_files ||= Hash.new{ |h,k| h[k] = [] }
82:       end
subclasses() click to toggle source

Returns the classes that inherits from Thor or Thor::Group.

Returns

Array[Class]

    # File lib/bundler/vendor/thor/base.rb, line 71
71:       def subclasses
72:         @subclasses ||= []
73:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.