diff options
author | Konstantin Haase <konstantin.mailinglists@googlemail.com> | 2014-11-29 01:26:10 +0100 |
---|---|---|
committer | Konstantin Haase <konstantin.mailinglists@googlemail.com> | 2014-11-29 01:26:10 +0100 |
commit | 0d690d75fbb088e967556ea186140ec96b320c42 (patch) | |
tree | 225d6423f2aead298ff4389f3e6f837a69266f58 /actionpack/lib | |
parent | b599f99281d54047751e48789c44b73ccaec124c (diff) | |
download | rails-0d690d75fbb088e967556ea186140ec96b320c42.tar.gz rails-0d690d75fbb088e967556ea186140ec96b320c42.tar.bz2 rails-0d690d75fbb088e967556ea186140ec96b320c42.zip |
make OR in journey patterns compile to a valid regular expression
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/path/pattern.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb index 3af940a02f..0d82008d8e 100644 --- a/actionpack/lib/action_dispatch/journey/path/pattern.rb +++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb @@ -122,6 +122,11 @@ module ActionDispatch re = @matchers[node.left.to_sym] || '.+' "(#{re})" end + + def visit_OR(node) + children = node.children.map { |n| visit n } + "(?:#{children.join(?|)})" + end end class UnanchoredRegexp < AnchoredRegexp # :nodoc: |