module Thor::Base
def initialize(args=[], options={}, config={})
config
access, magic predicates (options.skip?) and then frozen.
The hash given is converted to a hash with indifferent
options
respective accessors declared with argument.
args
==== Parameters
It should be done by the parser.
Notice that it does not check if all required arguments were supplied.
other for configuration.
It receives arguments in an Array and two hashes, one for options and
def initialize(args=[], options={}, config={}) args = Thor::Arguments.parse(self.class.arguments, args) args.each { |key, value| send("#{key}=", value) } parse_options = self.class.class_options if options.is_a?(Array) task_options = config.delete(:task_options) # hook for start parse_options = parse_options.merge(task_options) if task_options array_options, hash_options = options, {} else array_options, hash_options = [], options end opts = Thor::Options.new(parse_options, hash_options) self.options = opts.parse(array_options) opts.check_unknown! if self.class.check_unknown_options?(config) end