Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@raggi raggi authored
Showing with 1 addition and 15 deletions.
  1. +1 −15 lib/rack/mime.rb
View
16 lib/rack/mime.rb
@@ -29,21 +29,7 @@ def match?(value, matcher)
v1, v2 = value.split('/', 2)
m1, m2 = matcher.split('/', 2)
- if m1 == '*'
- if m2.nil? || m2 == '*'
- return true
- elsif m2 == v2
- return true
- else
- return false
- end
- end
-
- return false if v1 != m1
-
- return true if m2.nil? || m2 == '*'
-
- m2 == v2
+ (m1 == '*' || v1 == m1) && (m2.nil? || m2 == '*' || m2 == v2)
end
module_function :match?
Please sign in to comment.
Something went wrong with that request. Please try again.