Get the latest tech news
Better Know a Ruby Thing: Singleton Classes
I just write here
As far as I can tell, the term “eigenclass” is unique to Ruby, but I didn’t look that hard, maybe Matz picked it up from some obscure 60s language. This is the kind of thing that makes perfect sense when you read the line of code calling User.from_data, and only gets complicated when you have to worry about how to implement that behavior. Honestly, I think I like x.define_singleton_method(:foo) more than def x.foo for non-class objects on the grounds that it’s more explicit, but that’s a pretty weak opinion, using either should be quite rare.
Or read this on Hacker News