I have the following classes:
CachedObjectDbSource < CachedObjectSource
CachedObjectDalliSource < CachedObjectSource
Ruby doesn't know interfaces similar to e.g. Java. Instead, Ruby programs typically use an approach called Duck Typing which basically means that you can send any message to any object which then can decide if it will respond to that, i.e. each object decides on its own which methods it has.
The closest thing you can get to an "interface" is a class (or module) that implements a method but only raises a
NotImplementedError similar to this:
class CachedObjectSource def my_method raise NotImplementedError, "Implement this method in a child class" end end
That way, the method will be present and return a sensible error when called without being overwritten in a child class. Then, you should write some documentation making it clear what child classes have to implement to be compliant.