module Thor::Invocation

def _retrieve_class_and_task(name, sent_task=nil) #:nodoc:

:nodoc:
prepare_for_invocation in the current class.
use the given name and return self as class. Otherwise, call
If the name is nil or the given name is a task in the current class,
This method simply retrieves the class and task to be invoked.
def _retrieve_class_and_task(name, sent_task=nil) #:nodoc:
  case
  when name.nil?
    [self.class, nil]
  when self.class.all_tasks[name.to_s]
    [self.class, name.to_s]
  else
    klass, task = self.class.prepare_for_invocation(nil, name)
    [klass, task || sent_task]
  end
end