From eb493f5ac84f2d65fbd1666e1496f0a8deafa27f Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Thu, 20 Dec 2012 15:42:39 -0500 Subject: update AD::Journey to follow Rails coding conventions --- actionpack/lib/action_dispatch/journey/route.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_dispatch/journey/route.rb') diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index 2de711f091..d18efd863a 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -11,7 +11,7 @@ module ActionDispatch ## # +path+ is a path constraint. # +constraints+ is a hash of constraints to be applied to this route. - def initialize name, app, path, constraints, defaults = {} + def initialize(name, app, path, constraints, defaults = {}) constraints = constraints.dup @name = name @app = app @@ -52,7 +52,7 @@ module ActionDispatch path.required_names.map { |x| x.to_sym } + required_defaults.keys end - def score constraints + def score(constraints) required_keys = path.required_names supplied_keys = constraints.map { |k,v| v && k.to_s }.compact @@ -67,7 +67,7 @@ module ActionDispatch end alias :segment_keys :parts - def format path_options + def format(path_options) path_options.delete_if do |key, value| value.to_s == defaults[key].to_s && !required_parts.include?(key) end @@ -86,7 +86,7 @@ module ActionDispatch def required_defaults @required_defaults ||= begin matches = parts - @defaults.dup.delete_if { |k,_| matches.include? k } + @defaults.dup.delete_if { |k,_| matches.include?(k) } end end end -- cgit v1.2.3