Flowdock
method

new

Importance_0
v3.0.9 - Show latest stable - 0 notes - Class: ActionDispatch::Routing::Route
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 7
      def initialize(set, app, conditions, requirements, defaults, name, anchor)
        @set = set
        @app = app
        @defaults = defaults
        @name = name

        @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

        @conditions = conditions.inject({}) { |h, (k, v)|
          h[k] = Rack::Mount::RegexpWithNamedGroups.new(v)
          h
        }

        @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.