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.
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
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
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
Returns the files where the subclasses are kept.
Hash[path
# File lib/bundler/vendor/thor/base.rb, line 80 80: def subclass_files 81: @subclass_files ||= Hash.new{ |h,k| h[k] = [] } 82: end
Returns the classes that inherits from Thor or Thor::Group.
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.
Generated with the Darkfish Rdoc Generator 1.1.6.