diff options
| author | take_cheeze <[email protected]> | 2014-06-20 22:07:44 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-06-23 19:51:27 +0900 |
| commit | 1633469e9c881003caa1589a12b3592289df8901 (patch) | |
| tree | 0ab627277d8548c875378a970f1323309aaf3f1f /mrbgems/mruby-symbol-ext | |
| parent | 7015493efbc2efe6820d65eabad387f3fea4a414 (diff) | |
| download | mruby-1633469e9c881003caa1589a12b3592289df8901.tar.gz mruby-1633469e9c881003caa1589a12b3592289df8901.zip | |
Reduce string creation in `Symbol#casecmp` by using `case!`.
Diffstat (limited to 'mrbgems/mruby-symbol-ext')
| -rw-r--r-- | mrbgems/mruby-symbol-ext/mrblib/symbol.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb index 1e249c281..acb2a562c 100644 --- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb @@ -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 # |
