From 08eafe21d305e17c41b0221cae22dc1e90bee9cf Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 4 Oct 2019 14:42:01 +0900 Subject: Implement Ruby2.7's frozen strings from `Symbol#to_s`. --- mrbgems/mruby-symbol-ext/mrblib/symbol.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mrbgems') diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb index 99fa275d5..4b4cf83fe 100644 --- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb @@ -10,7 +10,7 @@ class Symbol # Same as sym.to_s.capitalize.intern. def capitalize - (self.to_s.capitalize! || self).to_sym + self.to_s.capitalize.to_sym end ## @@ -20,7 +20,7 @@ class Symbol # Same as sym.to_s.downcase.intern. def downcase - (self.to_s.downcase! || self).to_sym + self.to_s.downcase.to_sym end ## @@ -30,7 +30,7 @@ class Symbol # Same as sym.to_s.upcase.intern. def upcase - (self.to_s.upcase! || self).to_sym + self.to_s.upcase.to_sym end ## @@ -41,7 +41,7 @@ class Symbol def casecmp(other) return nil unless other.kind_of?(Symbol) - lhs = self.to_s; lhs.upcase! + lhs = self.to_s.upcase rhs = other.to_s.upcase lhs <=> rhs end -- cgit v1.2.3