3 ms·
> What we’ve been calling “class methods” are actually instance methods of the metaclass. This also shows up if you ever want to use a Refinement on a “class m
by Lammy 2y ago
> What we’ve been calling “class methods” are actually instance methods of the metaclass.
This also shows up if you ever want to use a Refinement on a “class method”. The thing you must `refine` is the `singleton_class`.
Here's a live example from my UUID library where I refine `Time::now` and one of my own utility class' methods to test the time-went-backwards and network-card-changed cases for incrementing the sequence value while generating time-based UUIDs: https://github.com/okeeblow/DistorteD/blob/3e9bbc744479afd3eb27c37933d78721b0887c77/Globe%20Glitter/lib/globeglitter/chrono_seeker.rb#L9-L26 https://github.com/okeeblow/DistorteD/blob/3e9bbc744479afd3e...