3 ms·
Josh, I have not looked into the details of your framework, but why not simplify the DSL to: path 'blog' do |id| @blog = Blog.get(id) get { hal
by acangiano 15y ago
Josh, I have not looked into the details of your framework, but why not simplify the DSL to:
path 'blog' do |id|
@blog = Blog.get(id)
get { halt @blog }
put { @blog.update(request.params); halt :ok}
end
Why do you need the var call within the block? Also, you seem to break the ruby convention of using do end for blocks larger than one line, in many of your examples.
(Again, I spent three seconds on your site, so you may have a solid reason for this and have explained it already as well.)
- joshbuddy 15y agoThis very well might be the next iteration in fact. There is no "good reason" aside from simplicity. One of the reasons against this is var can take validation. So, you can do the following. var Integer do |id| this will only continue if it matches against an Integer (and it will also cast it for you). The argument list might get hella complicated if you allow munging like that. I am considering allowing chaining though, so, path('blog').var do |id| What would you think of that?
- nesquena 15y agoYeah this is an early release. I can think of several ways to enhance the DSL even more with ideas similar to this to cleanup common cases.
- joshbuddy 15y agoYeah, exactly. I wanna get a better handle on what these common cases are, so, comments like this are wonderful.