Method: Thor::Base::ClassMethods#no_tasks

Defined in:
lib/thor/base.rb

#no_tasksObject

All methods defined inside the given block are not added as tasks.

So you can do:

class MyScript < Thor
  no_tasks do
    def this_is_not_a_task
    end
  end
end

You can also add the method and remove it from the task list:

class MyScript < Thor
  def this_is_not_a_task
  end
  remove_task :this_is_not_a_task
end


341
342
343
344
345
346
# File 'lib/thor/base.rb', line 341

def no_tasks
  @no_tasks = true
  yield
ensure
  @no_tasks = false
end