Created
March 29, 2011 02:52
-
-
Save ryanlecompte/891728 to your computer and use it in GitHub Desktop.
BUG with Ruby 1.9.2 (MRI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following fails with a failure to call "x=" private method | |
String.send(:attr_accessor, :x) | |
s = "" | |
s.x = 100 | |
# The following works: | |
class String | |
self.send(:attr_accessor, :x) | |
end | |
s = "" | |
s.x = 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment