class Thor
def normalize_task_name(meth) #:nodoc:
into +animal_prison+.
+normalize_task_name+ also converts names like +animal-prison+
a task or alias.
will determine if a shortened command is an unambiguous prefix of
the tasks hash. In addition to normalizing aliases, this logic
receives a (possibly nil) task name and returns a name that is in
def normalize_task_name(meth) #:nodoc: return default_task.to_s.gsub('-', '_') unless meth possibilities = find_task_possibilities(meth) if possibilities.size > 1 raise ArgumentError, "Ambiguous task #{meth} matches [#{possibilities.join(', ')}]" elsif possibilities.size < 1 meth = meth || default_task elsif map[meth] meth = map[meth] else meth = possibilities.first end meth.to_s.gsub('-','_') # treat foo-bar as foo_bar end