Skip to content

Commit

Permalink
Refactor Rack::Mime.match? conditionals to make them a bit cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Feb 9, 2013
1 parent 0722c99 commit 5823752
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions lib/rack/mime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down

0 comments on commit 5823752

Please sign in to comment.