summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-symbol-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-10-04 14:42:01 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2019-10-04 14:42:01 +0900
commit08eafe21d305e17c41b0221cae22dc1e90bee9cf (patch)
tree1fdad300a627afa3641b65b8e25bf34521b3e5f9 /mrbgems/mruby-symbol-ext
parent264239f78fb9ec8047cf04b82f547fc41d65ab28 (diff)
downloadmruby-08eafe21d305e17c41b0221cae22dc1e90bee9cf.tar.gz
mruby-08eafe21d305e17c41b0221cae22dc1e90bee9cf.zip
Implement Ruby2.7's frozen strings from `Symbol#to_s`.
Diffstat (limited to 'mrbgems/mruby-symbol-ext')
-rw-r--r--mrbgems/mruby-symbol-ext/mrblib/symbol.rb8
1 files changed, 4 insertions, 4 deletions
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 <code>sym.to_s.capitalize.intern</code>.
def capitalize
- (self.to_s.capitalize! || self).to_sym
+ self.to_s.capitalize.to_sym
end
##
@@ -20,7 +20,7 @@ class Symbol
# Same as <code>sym.to_s.downcase.intern</code>.
def downcase
- (self.to_s.downcase! || self).to_sym
+ self.to_s.downcase.to_sym
end
##
@@ -30,7 +30,7 @@ class Symbol
# Same as <code>sym.to_s.upcase.intern</code>.
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