module Roda::RodaPlugins::Break

  1. lib/roda/plugins/break.rb

The break plugin supports calling break inside a match block, to return from the block and continue in the routing tree, restoring the remaining path so that future matchers operating on the path operate as expected.

plugin :break

route do |r|
  r.on "foo", :bar do |bar|
    break if bar == 'baz'
    "/foo/#{bar} (not baz)"

  r.on "foo/baz" do

This provides the same basic feature as the pass plugin, but uses Ruby’s standard control flow primative instead of a separate method.