Get eigenclass in Ruby
We often need egenclass to write revolutionary code.
You can use Object#singleton_class to get it more easily!
before
(class << obj; self end) #=> #<Class:#<Object:xxx>>
after
obj.singleton_class #=> #<Class:#<Object:xxx>>
(required over Ruby 1.9.2)
Written by Tomohiro Nishimura
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#