diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-12 10:37:36 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-12 14:30:52 -0700 |
commit | b9a622f817b28b7796c5d5c78ec294b35ae7dfe2 (patch) | |
tree | c731f12ffbf065d69ece7f131a9b12735e94b1bd /actionpack/lib | |
parent | 463339c4bb5d5f39801b21a0e4c72e44b416101d (diff) | |
download | rails-b9a622f817b28b7796c5d5c78ec294b35ae7dfe2.tar.gz rails-b9a622f817b28b7796c5d5c78ec294b35ae7dfe2.tar.bz2 rails-b9a622f817b28b7796c5d5c78ec294b35ae7dfe2.zip |
switch === to case / when
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 7 |
1 files changed, 4 insertions, 3 deletions
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 |