From b9a622f817b28b7796c5d5c78ec294b35ae7dfe2 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 12 Aug 2015 10:37:36 -0700 Subject: switch === to case / when --- actionpack/lib/action_dispatch/routing/mapper.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 111546c285..de8d0abb86 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -191,12 +191,13 @@ module ActionDispatch end def normalize_format!(formatted) - if formatted == true + case formatted + when true @requirements[:format] ||= /.+/ - elsif Regexp === formatted + when Regexp @requirements[:format] ||= formatted @defaults[:format] ||= nil - elsif String === formatted + when String @requirements[:format] ||= Regexp.compile(formatted) @defaults[:format] ||= formatted end -- cgit v1.2.3