diff options
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 |