Skip to content

Instantly share code, notes, and snippets.

@avescodes
Created October 26, 2010 15:26
Show Gist options
  • Save avescodes/647110 to your computer and use it in GitHub Desktop.
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*
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