I have created a patch heavily inspired from ruby-ts-mode. It fixes the trivial examples and it works as expected in a more complex file. I'm not sure if the commit message is formatted properly.