lib/usher/node.rb in joshbuddy-usher-0.5.2 vs lib/usher/node.rb in joshbuddy-usher-0.5.3
- old
+ new
@@ -143,11 +143,11 @@
request_methods.each do |type|
parts.push(Route::RequestMethod.new(type, path.route.conditions[type])) if path.route.conditions && path.route.conditions.key?(type)
end
current_node = self
- until parts.size.zero?
+ while !parts.size.zero? || current_node.exclusive_type
key = parts.shift
target_node = case key
when Route::RequestMethod
current_node.upgrade_lookup if key.value.is_a?(Regexp)
if current_node.exclusive_type == key.type
@@ -172,14 +172,16 @@
current_node.send(lookup_method)[key.regex_matcher] ||= Node.new(current_node, key)
else
current_node.send(lookup_method)[nil] ||= Node.new(current_node, key)
end
else
+
current_node.upgrade_lookup if key.is_a?(Regexp)
current_node.lookup[key] ||= Node.new(current_node, key)
end
current_node = target_node
end
+
current_node.terminates = destination
end
end