diff options
author | Gosha Arinich <me@goshakkk.name> | 2013-01-03 12:59:56 +0300 |
---|---|---|
committer | Gosha Arinich <me@goshakkk.name> | 2013-01-03 13:06:42 +0300 |
commit | 77f2ba9559ff53987ce3e026f33275678617768e (patch) | |
tree | 1bd58c8b10b062918b40b3d0b84a451c555b88b0 /actionpack/lib/action_dispatch | |
parent | ef61504c6ea4c282cf85ab54797ff708ec6031c9 (diff) | |
download | rails-77f2ba9559ff53987ce3e026f33275678617768e.tar.gz rails-77f2ba9559ff53987ce3e026f33275678617768e.tar.bz2 rails-77f2ba9559ff53987ce3e026f33275678617768e.zip |
refactor Routing::Mapper
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 0dc6403ec0..a21383e091 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -26,15 +26,10 @@ module ActionDispatch def matches?(env) req = @request.new(env) - @constraints.each { |constraint| - if constraint.respond_to?(:matches?) && !constraint.matches?(req) - return false - elsif constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req)) - return false - end - } - - return true + @constraints.none? do |constraint| + (constraint.respond_to?(:matches?) && !constraint.matches?(req)) || + (constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req))) + end ensure req.reset_parameters end |