lib/galago/router/path.rb in galago-router-0.1.1 vs lib/galago/router/path.rb in galago-router-0.2.0

- old
+ new

@@ -22,15 +22,18 @@ def named_parameters @path_parameters ||= @path.scan(/\:(\w+)/).flatten end - def add_path_params_to_env(env) + def params_from(env) request = Rack::Request.new(env) + params = request.params if path_params = identify_params_in_path(request.path) - path_params.each { |key, value| request.update_param(key, value) } + params.merge(path_params) + else + params end end def to_s @path @@ -47,10 +50,10 @@ /\A#{regexp}$/ end def identify_params_in_path(path) if match = regex.match(path) - named_parameters.zip(match.captures) + Hash[named_parameters.zip(match.captures)] end end end end