Skip to content
This repository
Browse code

Merge pull request #513 from spastorino/mime_match_conditionals

Make Rack::Mime.match? conditionals a bit cleaner
  • Loading branch information...
commit 7b535cd7ce78eaaaec99cd2677ad8dd5962019a4 2 parents 0722c99 + 5823752
James Tucker authored February 09, 2013

Showing 1 changed file with 1 addition and 15 deletions. Show diff stats Hide diff stats

  1. 16  lib/rack/mime.rb
16  lib/rack/mime.rb
@@ -29,21 +29,7 @@ def match?(value, matcher)
29 29
       v1, v2 = value.split('/', 2)
30 30
       m1, m2 = matcher.split('/', 2)
31 31
 
32  
-      if m1 == '*'
33  
-        if m2.nil? || m2 == '*'
34  
-          return true
35  
-        elsif m2 == v2
36  
-          return true
37  
-        else
38  
-          return false
39  
-        end
40  
-      end
41  
-
42  
-      return false if v1 != m1
43  
-
44  
-      return true if m2.nil? || m2 == '*'
45  
-
46  
-      m2 == v2
  32
+      (m1 == '*' || v1 == m1) && (m2.nil? || m2 == '*' || m2 == v2)
47 33
     end
48 34
     module_function :match?
49 35
 

0 notes on commit 7b535cd

Please sign in to comment.
Something went wrong with that request. Please try again.