Custom Route Matchers example fails #1667
Open
Labels
Comments
|
I figured out a fix for my problem, but I am not sure its a good one: require 'sinatra'
class AllButPattern
def initialize(except)
@except = except
end
def to_pattern(**options)
return self
end
def params(route)
return {} unless @except === route
end
end
def all_but(pattern)
AllButPattern.new(pattern)
end
get all_but("/index") do
"yep yep yep"
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to write my own custom route matcher and using the example in the readme, I receive the following error:
AllButPattern can't be coerced into Mustermann::Pattern (TypeError)Here is my example code:
It would seem as if the API for these matchers has changed with the introduction of Mustermann (4 odd years ago).
The text was updated successfully, but these errors were encountered: