From a729f4050766f97750dd006217a175229b09da34 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 28 May 2014 16:31:40 -0700 Subject: change to case / when on types --- actionpack/lib/action_dispatch/routing/mapper.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 5027425d6b..72edf6725c 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -247,16 +247,15 @@ module ActionDispatch @scope[:module] ) - if controller.is_a? Regexp + case controller + when Regexp hash[:controller] = controller + when String, Symbol + hash[:controller] = check_controller!(controller).to_s else - if controller - hash[:controller] = check_controller!(controller).to_s - else - unless segment_keys.include?(:controller) - message = "Missing :controller key on routes definition, please check your routes." - raise ArgumentError, message - end + unless segment_keys.include?(:controller) + message = "Missing :controller key on routes definition, please check your routes." + raise ArgumentError, message end end -- cgit v1.2.3