gem install eigenclass
Eigenclasses aka metaclasses or singleton classes in Ruby: https://github.com/shuber/eigenclass
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Eigenclasses aka metaclasses or singleton classes in Ruby: https://github.com/shuber/eigenclass
Comments
Am I missing something? Why not using
Object#singleton_classinstead? Also,Object#singleton_class.instance_eval(&block)andObject#define_singleton_method.I don’t see the point of this gem. Can you explain why would one add this gem?
This gem was originally written before those methods were introduced in Ruby 1.9. It also adds a bunch of convenience methods for defining accessors, aliases, and methods at the “eigenclass” level. It was recently updated to be used as a teaching tool for the newer Ruby developers on my team since it digs into the object model system a bit.
Teaching purposes. 👍
Post a comment