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