Working Ruby Implementation

Understood the concept of self.<function> and fixed things. Works.