ruby: codegen unit.caste_tg helper