gist: 1504 Download_button fork
public
Public Clone URL: git://gist.github.com/1504.git
Ruby
1
2
3
4
5
6
7
8
9
10
11
Router.prepare do |r|
  r.match("/something", :user_agent => %r[some/complex/regexp/with/parentheses]).to(:browser => ":user_agent[1]")
end
 
Router.generate(:browser => "something")
 
# => I can't tell if something is a valid match
# from the original :user_agent regex
 
# since we have :browser => "something", and we know that :browser is :user_agent[1], we match "something" against the regex
# in :user_agent and check to see whether the match[1] is non-nil.

Owner

engineyard

Fork Of

Revisions