Method: Bundler::Thor::Base::ClassMethods#namespace
- Defined in:
- lib/bundler/vendor/thor/lib/thor/base.rb
#namespace(name = nil) ⇒ Object
Sets the namespace for the Bundler::Thor or Bundler::Thor::Group class. By default the namespace is retrieved from the class name. If your Bundler::Thor class is named Scripts::MyScript, the help method, for example, will be called as:
thor scripts:my_script -h
If you change the namespace:
namespace :my_scripts
You change how your commands are invoked:
thor my_scripts -h
Finally, if you change your namespace to default:
namespace :default
Your commands can be invoked with a shortcut. Instead of:
thor :my_command
422 423 424 425 426 427 428 |
# File 'lib/bundler/vendor/thor/lib/thor/base.rb', line 422 def namespace(name = nil) if name @namespace = name.to_s else @namespace ||= Bundler::Thor::Util.namespace_from_thor_class(self) end end |