Convert to boolean in C code
casecmp?(str) is 1.5x faster than casecmp(str).zero? It's 1 less method call in Ruby, and the C code can convert to boolean, rather than returning a number and determining if it's zero.
This commit is contained in:
@@ -2,7 +2,7 @@ require 'open-uri'
|
||||
|
||||
module OpenURI
|
||||
def self.redirectable?(uri1, uri2) # :nodoc:
|
||||
uri1.scheme.casecmp(uri2.scheme).zero? ||
|
||||
uri1.scheme.casecmp?(uri2.scheme) ||
|
||||
(/\A(?:http|https|ftp)\z/i =~ uri1.scheme && /\A(?:http|https|ftp)\z/i =~ uri2.scheme)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user