Browse files

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

  • Loading branch information...
1 parent 0722c99 commit 5823752af2b770ce0828c1fd7d9f9ceb4993257e @spastorino spastorino committed Feb 9, 2013
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?

0 comments on commit 5823752

Please sign in to comment.