lib/roda/plugins/backtracking_array.rb in roda-1.3.0 vs lib/roda/plugins/backtracking_array.rb in roda-2.0.0
- old
+ new
@@ -34,15 +34,11 @@
# matched, reset the state and continue to the next
# entry in the array.
def _match_array(arg, rest=nil)
return super unless rest
- unless path = @remaining_path
- e = @env
- script = e[SCRIPT_NAME]
- path = e[PATH_INFO]
- end
+ path = @remaining_path
captures = @captures
caps = captures.dup
arg.each do |v|
if match(v, rest)
if v.is_a?(String)
@@ -53,15 +49,10 @@
return true
end
# Matching all remaining elements failed, reset state
captures.replace(caps)
- if @remaining_path
- @remaining_path = path
- else
- e[SCRIPT_NAME] = script
- e[PATH_INFO] = path
- end
+ @remaining_path = path
end
end
false
end