A little gem I just published that allows you to create true abstract classes and methods in Ruby. Basically throws an error at instantiation / creation of an abstract class if abstract methods arent implemented.

While there are a few gems that allow you to create abstract classes and methods all of the ones i found just cause abstract methods to throw errors when called if not implemented. This solution actually throws an error when you attempt to create the class itself, so it is fail-fast and more in line with the spirit of an abstract method.



PS: Probably the first and only project I will ever write with a true 100% code coverage report :)

Β· Β· 0 Β· 0 Β· 1
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.