From: Run Paint Run Run Date: 2009-06-01T20:13:49+09:00 Subject: [ruby-core:23657] [Bug #1550] String#lstrip! raises RuntimeError on Frozen String Despite Making No Changes Bug #1550: String#lstrip! raises RuntimeError on Frozen String Despite Making No Changes http://redmine.ruby-lang.org/issues/show/1550 Author: Run Paint Run Run Status: Open, Priority: Normal ruby -v: ruby 1.9.2dev (2009-05-28 trunk 23601) [i686-linux] Calling String#lstrip! on a frozen string raises a RuntimeError even if the string was not changed. String#rstrip! doesn't raise an exception in this scenario. I believe that the latter behaviour is correct; #lstrip! should only raise a RuntimeError if the string would be changed. $ rubybleed -ve '"ruby".freeze.lstrip!' ruby 1.9.2dev (2009-05-28 trunk 23601) [i686-linux] -e:1:in `lstrip!': can't modify frozen string (RuntimeError) from -e:1:in `
' $ rubybleed -ve '"ruby".freeze.rstrip!' ruby 1.9.2dev (2009-05-28 trunk 23601) [i686-linux] 1.9.1 behaves the same as 1.9.2. 1.8.7 behaves correctly. ---------------------------------------- http://redmine.ruby-lang.org