method

route_namespace_pattern

Importance_0
v8.1.1 - Show latest stable - 0 notes - Class: Rails::Generators::Actions
route_namespace_pattern(namespace) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide 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
Register or log in to add new notes.