The command looks like this
autocmd! BufWritePost <buffer> mark s | $r ! ruby % | sed 's/^/\#=> /' | 's
It will append the output and move cursor to the original position, before appending.
This is the error I got:
Error detected while processing BufWritePost Auto commands for "<buffer=1>":
E485: Can't read file /var/folders/fw/045tt2q10zv1qkbfbw73y8c80000gn/T/vCDqw9b/7
If remove | 's at the end of line, it works fine, but no returning to the marked s position.