-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbol route matchers #38
Comments
I've never seen Roda before. It looks interesting and seems to have similar goals to Scorched. As for the predefined regular expressions, they're kind of nice I suppose. It shouldn't be too much effort to implement. Just another Scorched::Options object like we use for I'll keep this issue open and have a go at implementing it when I got a moment. |
What would some default symbol matchers be if I was to implement this? The only two obvious examples I can think of are:
|
I think those are the main ones. My main usecase is to separate resource id's from other routes. They are most likely to be numeric or user defined. My last project had
So mostly it was about defining my own in a slightly more manageable way. Possibly file types if people are working that way
I also wondered but might be a bit much about handing over a coersion block. Might be a bit much and errors could be annoying
|
Yeah it's going to be mostly project specific, but I can see it being useful where you may otherwise need to repeat an ugly regex. I do like the optional coercion block idea. As far as error handling, we'd just make sure that any exception raised in the coercion block is handled as if it occurred in the target proc. It'll be handled in an error filter up the chain. |
This has been added in v0.25. |
This perhaps belongs as a plugin rather than as a core feature. However I don't think it would conflict with any existing thinking. Simply it is symbol matchers as available in Roda, http://roda.jeremyevans.net/rdoc/classes/Roda/RodaPlugins/SymbolMatchers.html.
Somewhere is set up a regular expression for a particular symbol
Then when routing some of the ordering is no longer important
This is particularly useful if you want to mix in routes
The text was updated successfully, but these errors were encountered: