Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor Rack::Mime.match? conditionals to make them a bit cleaner

  • Loading branch information...
commit 5823752af2b770ce0828c1fd7d9f9ceb4993257e 1 parent 0722c99
@spastorino spastorino 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.