Skip to content

Instantly share code, notes, and snippets.

@ryanlecompte
Created March 29, 2011 02:52
Show Gist options
  • Save ryanlecompte/891728 to your computer and use it in GitHub Desktop.
Save ryanlecompte/891728 to your computer and use it in GitHub Desktop.
BUG with Ruby 1.9.2 (MRI)
# 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