Ruby Rinci/Riap implementation