Reduce string creation in Symbol#casecmp by using case!.

This commit is contained in:
take_cheeze
2014-06-20 22:07:44 +09:00
committed by Yukihiro "Matz" Matsumoto
parent 7015493efb
commit 1633469e9c
+3 -1
View File
@@ -45,7 +45,9 @@ class Symbol
def casecmp(other)
return nil unless other.kind_of?(Symbol)
self.to_s.upcase <=> other.to_s.upcase
lhs = self.to_s; lhs.upcase!
rhs = other.to_s; rhs.upcase!
lhs <=> rhs
end
#