Ruby: added generation of methods like class constructors