class Thor
def dispatch(meth, given_args, given_opts, config) #:nodoc:
The method responsible for dispatching given the args.
def dispatch(meth, given_args, given_opts, config) #:nodoc: meth ||= retrieve_task_name(given_args) task = all_tasks[normalize_task_name(meth)] if task args, opts = Thor::Options.split(given_args) else args, opts = given_args, nil task = Thor::DynamicTask.new(meth) end opts = given_opts || opts || [] config.merge!(:current_task => task, :task_options => task.options) instance = new(args, opts, config) yield instance if block_given? args = instance.args trailing = args[Range.new(arguments.size, -1)] instance.invoke_task(task, trailing || []) end