3 ms·
Idiomatic Ruby would not use inheritance in this case. 'Node' is a duck type and doesn't need to be explicitly defined. In 2004 this would have been written for
by djur 12y ago
Idiomatic Ruby would not use inheritance in this case. 'Node' is a duck type and doesn't need to be explicitly defined. In 2004 this would have been written for an audience more conversant in C++ and Java, where you'd need to use an abstract base class and an interface respectively.