I have the following classes:
CachedObject
CachedObjectSource
CachedObjectDbSource < CachedObjectSource
CachedObjectDalliSource < CachedObjectSource
CachedObject is a non-database object that is getting pulled from a third-party API and stored locally. CachedObject will be stored in both the database and Dalli (memcache), the real-time code will ping the Dalli source for a copy of the object, and the Dalli source will search the database source and update its cache if the object does not exist. So it's a nested call that requires each child class of CachedObjectSource to implement the same set of methods. IE, an interface.
Is there a way to write the CachedObjectSource class so that its child classes must implement the interface? Am I going about this the wrong way?
CachedObjectSourceimplement the same methods, maybe the Ruby way is to write a unit test that contains a list of expected methods, and verifies that an instance of each type of sourceresponds_to?each method in the list.