diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-09-12 16:11:55 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-09-12 16:50:49 -0700 |
commit | ad1a89164927e1d87062a350ce259b3713c9e898 (patch) | |
tree | e9d4f2f21e9d0a0a1e5b3499f1bdabab8a73b132 /actionpack/lib/action_dispatch/routing/route.rb | |
parent | 943aa826a48c7db682e24f13cc93ed3298aa7e1a (diff) | |
download | rails-ad1a89164927e1d87062a350ce259b3713c9e898.tar.gz rails-ad1a89164927e1d87062a350ce259b3713c9e898.tar.bz2 rails-ad1a89164927e1d87062a350ce259b3713c9e898.zip |
unfactor the Route class to private factory methods
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/route.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route.rb | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route.rb b/actionpack/lib/action_dispatch/routing/route.rb deleted file mode 100644 index 76d18e4dd5..0000000000 --- a/actionpack/lib/action_dispatch/routing/route.rb +++ /dev/null @@ -1,40 +0,0 @@ -module ActionDispatch - module Routing - class Route #:nodoc: - attr_reader :conditions, :path - - def initialize(valid_conditions, app, conditions, requirements, defaults, name, anchor) - @valid_conditions = valid_conditions - strexp = Journey::Router::Strexp.new( - conditions.delete(:path_info), - requirements, - SEPARATORS, - anchor) - - @path = Journey::Path::Pattern.new(strexp) - - @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. - unless @verbs.empty? - @conditions[:request_method] = %r[^#{@verbs.join('|')}$] - end - @conditions.delete_if{ |k,v| !valid_condition?(k) } - end - - def segment_keys - @segment_keys ||= path.names.compact.map { |key| key.to_sym } - end - - private - def valid_condition?(method) - segment_keys.include?(method) || @valid_conditions.include?(method) - end - end - end -end |