new(scope, set, path, defaults, as, options) public

No documentation

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

Hide source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 82
        def initialize(scope, set, path, defaults, as, options)
          @requirements, @conditions = {}, {}
          @defaults = defaults
          @set = set

          @to                 = options.delete :to
          @default_controller = options.delete(:controller) || scope[:controller]
          @default_action     = options.delete(:action) || scope[:action]
          @as                 = as
          @anchor             = options.delete :anchor

          formatted = options.delete :format
          via = Array(options.delete(:via) { [] })
          options_constraints = options.delete :constraints

          path = normalize_path! path, formatted
          ast  = path_ast path
          path_params = path_params ast

          options = normalize_options!(options, formatted, path_params, ast, scope[:module])


          split_constraints(path_params, scope[:constraints]) if scope[:constraints]
          constraints = constraints(options, path_params)

          split_constraints path_params, constraints

          @blocks = blocks(options_constraints, scope[:blocks])

          if options_constraints.is_a?(Hash)
            split_constraints path_params, options_constraints
            options_constraints.each do |key, default|
              if URL_OPTIONS.include?(key) && (String === default || Integer === default)
                @defaults[key] ||= default
              end
            end
          end

          normalize_format!(formatted)

          @conditions[:path_info] = path
          @conditions[:parsed_path_info] = ast

          add_request_method(via, @conditions)
          normalize_defaults!(options)
        end
Register or log in to add new notes.