instance method
route_namespace_pattern
Ruby on Rails 7.1.6
Since v7.0.10 PrivateSignature
route_namespace_pattern(namespace)
No documentation comment.
Parameters
-
namespacereq
Source
# File railties/lib/rails/generators/actions.rb, line 517
def route_namespace_pattern(namespace)
namespace.each_with_index.reverse_each.reduce(nil) do |pattern, (name, i)|
cummulative_margin = "\\#{i + 1}[ ]{2}"
blank_or_indented_line = "^[ ]*\n|^#{cummulative_margin}.*\n"
"(?:(?:#{blank_or_indented_line})*?^(#{cummulative_margin})namespace :#{name} do\n#{pattern})?"
end.then do |pattern|
/^([ ]*).+\.routes\.draw do[ ]*\n#{pattern}/
end
end
Defined in railties/lib/rails/generators/actions.rb line 517
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generators::Actions