Conditions for filters? #58

Closed
rkh opened this Issue Sep 4, 2010 · 5 comments

Projects

None yet

4 participants

@rkh
Sinatra member
rkh commented Sep 4, 2010

I'm not sure if this is wanted, but it would sure be pretty easy to implement (as routes and filters already share a lot of code):

before '/:name', :agent => /Songbird/ do
  # ...
end

before :host => /^mobile\./ do
  # ...
end

What do you guys think about it? Would that be useful?

@daz4126

Definitely! I'd like to see :except and :only conditions

DAZ

@rkh
Sinatra member
rkh commented Nov 3, 2010

Patch: sinatra:filter-conditions (not yet merged into master).
Does not include :except and :only, yet. Those should be a separate ticket.

@ensirius

Is it implemented atm?

@basex

Here you can see some examples: http://www.sinatrarb.com/intro.html

before :agent => /Songbird/ do
  # ...
end

after '/blog/*', :host_name => 'example.com' do
  # ...
end
@ensirius

How about :except?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment