Tuesday, October 11, 2011

That's cool

Ruby has no interfaces, but let's see what we can do:

module FooInterface
def bar(a,b) raise "bar(a,b) must be overridden"; end
end

class FooClass
include FooInterface
def bar(a,b) a+b; end
end

It's not particularly robust, but ehh, this isn't Java.