At present the comments are preserved, but the auto-generation notice bumps them down below line 1 where they've no effect.
The documentation comment on the syntax of magic comments is:
The added regex test tracks the doc comment, except I don't bother checking the encoding string (say, with Encoding.find($2)), as I figure that's Ruby's business and users will find out soon enough if they've botched an encoding string.
keep magic comments at the top of generated files
Apparently I pushed this to nathansobo's repo, not to mine - which is where I release from. Sorry. By today I'd forgotten that your patch existed, needed it, wrote it, republished the gem, and only found your pull request when I went to the mailing list archive to notify interested parties that 1.4.14 now has a fox for this. D'oh! But anyhow, it's fixed, and the new gem is released.