Use FrozenError instead of RuntimeError in String#rstrip!

This commit is contained in:
KOBAYASHI Shuji
2019-03-15 22:49:40 +09:00
parent 298807fa4e
commit cd4daf78ec
+1 -1
View File
@@ -93,7 +93,7 @@ class String
# "hello".rstrip! #=> nil
#
def rstrip!
raise RuntimeError, "can't modify frozen String" if frozen?
raise FrozenError, "can't modify frozen String" if frozen?
s = self.rstrip
(s == self) ? nil : self.replace(s)
end