Flowdock
method

new

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: ActionDispatch::Routing::Route

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.1.0) is shown here.

These similar methods exist in v6.1.7.7:

new(set, app, conditions, requirements, defaults, name, anchor) 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/route.rb, line 9
      def initialize(set, app, conditions, requirements, defaults, name, anchor)
        @set = set
        @app = app
        @defaults = defaults
        @name = name

        # FIXME: we should not be doing this much work in a constructor.

        @requirements = requirements.merge(defaults)
        @requirements.delete(:controller) if @requirements[:controller].is_a?(Regexp)
        @requirements.delete_if { |k, v|
          v == Regexp.compile("[^#{SEPARATORS.join}]+")
        }

        if path = conditions[:path_info]
          @path = path
          conditions[:path_info] = ::Rack::Mount::Strexp.compile(path, requirements, SEPARATORS, anchor)
        end

        @verbs = conditions[:request_method] || []

        @conditions = conditions.dup

        # Rack-Mount requires that :request_method be a regular expression.
        # :request_method represents the HTTP verb that matches this route.
        #
        # Here we munge values before they get sent on to rack-mount.
        @conditions[:request_method] = %[^#{verb}$] unless @verbs.empty?
        @conditions[:path_info] = Rack::Mount::RegexpWithNamedGroups.new(@conditions[:path_info]) if @conditions[:path_info]
        @conditions.delete_if{ |k,v| k != :path_info && !valid_condition?(k) }
        @requirements.delete_if{ |k,v| !valid_condition?(k) }
      end
Register or log in to add new notes.