psychoslave / englishest

A Ruby gem which allows a more literate coding style
MIT License
0 stars 0 forks source link

Investigate a cleaner way to implement reification of classes with instance methods #8

Open psychoslave opened 2 years ago

psychoslave commented 2 years ago

The code currently hold this ugly line:

          aim = "::Englishest::#{to_s.split(":").last.chomp(">")}::SINGLETON_METHOD_ALIASES"

This is obviously a quick a dirty way to make things work™, but is all but clean code. As this peace of code is within a class <<self scope, a more proper solution like ::Englishest::#{self}::SINGLETON_METHOD_ALIASES is inoperative.

The goal here is to replace the approach that led to this line with something cleaner.

psychoslave commented 2 years ago

It looks like there is no native counterpart to singleton_class to retrieve the object from which the singleton is derived. Other solutions might exist, but those found so far were more demanding in resources.