Created
October 26, 2010 15:26
-
-
Save avescodes/647110 to your computer and use it in GitHub Desktop.
Creating/calling instance methods defined on class instances that are defined on that classes instance meta-class instance *head-explode*
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
ruby-1.9.2-p0 > string = "ABC" | |
=> "ABC" | |
ruby-1.9.2-p0 > def string.thing | |
ruby-1.9.2-p0 > puts 'abc' | |
ruby-1.9.2-p0 > end | |
=> nil | |
ruby-1.9.2-p0 > string.thing | |
abc | |
=> nil | |
ruby-1.9.2-p0 > "abc".thing | |
NoMethodError: undefined method `thing' for "abc":String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment