Define singleton methods for ruby class members
https://gist.github.com/3071299
I've been writing a simple utility for MongoDB. Ran into an issue where methods were being overwritten for all instances of the class. Figured out that all the methods need to be defined as singletons on each instance so that the proper data is returned. This will work for ruby 1.9.2. May be a busch league mistake, but hey we all gotta learn some time.
Written by Matthew Dobson
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#