mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Reduce string creation in Symbol#casecmp by using case!.
This commit is contained in:
committed by
Yukihiro "Matz" Matsumoto
parent
7015493efb
commit
1633469e9c
@@ -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
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user