instance method
extract_modules
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18 PrivateAvailable in: v2.2.3 v2.3.18
Signature
extract_modules(name)
Extract modules from filesystem-style or ruby-style path:
good/fun/stuff Good::Fun::Stuff
produce the same results.
Parameters
-
namereq
Source
# File railties/lib/rails_generator/base.rb, line 246
def extract_modules(name)
modules = name.include?('/') ? name.split('/') : name.split('::')
name = modules.pop
path = modules.map { |m| m.underscore }
file_path = (path + [name.underscore]).join('/')
nesting = modules.map { |m| m.camelize }.join('::')
[name, path, file_path, nesting, modules.size]
end
Defined in railties/lib/rails_generator/base.rb line 246
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generator::NamedBase