class method
self.namespace
Ruby on Rails 7.0.10
Since v3.0.20Signature
self.namespace(name = nil)
Convenience method to get the namespace from the class name. It’s the same as Thor default except that the Generator at the end of the class is removed.
Parameters
-
nameopt = nil
Source
# File railties/lib/rails/generators/base.rb, line 54
def self.namespace(name = nil)
return super if name
@namespace ||= super.delete_suffix("_generator").sub(/:generators:/, ":")
end
Defined in railties/lib/rails/generators/base.rb line 54
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generators::Base