Module: Roda::RodaPlugins::BacktrackingArray

Defined in:


The backtracking_array plugin changes the handling of array matchers such that if one of the array entries matches, but a later match argument fails, it will backtrack and try the next entry in the array. For example, the following match block does not match /a/b by default: ['a', 'a/b'] do |path|
  # ...

This is because the 'a' entry in the array matches, which makes the array match. However, the next matcher is the terminal matcher (since was used), and since the path is not terminal as it still contains /b after matching 'a'.

With the backtracking_array plugin, when the terminal matcher fails, matching will go on to the next entry in the array, 'a/b', which will also match. Since 'a/b' matches the path fully, the terminal matcher also matches, and the match block yields.

Defined Under Namespace

Modules: RequestMethods