Method: Thor::Base::ClassMethods#remove_task

Defined in:
lib/vendor/thor/lib/thor/base.rb

#remove_task(*names) ⇒ Object

Removes a given task from this Thor class. This is usually done if you are inheriting from another class and don't want it to be available anymore.

By default it only remove the mapping to the task. But you can supply :undefine => true to undefine the method from the class as well.

Parameters

name<Symbol|String>

The name of the task to be removed

options

You can give :undefine => true if you want tasks the method to be undefined from the class as well.



348
349
350
351
352
353
354
355
356
# File 'lib/vendor/thor/lib/thor/base.rb', line 348

def remove_task(*names)
  options = names.last.is_a?(Hash) ? names.pop : {}

  names.each do |name|
    tasks.delete(name.to_s)
    all_tasks.delete(name.to_s)
    undef_method name if options[:undefine]
  end
end