The attached patch applied over the current ebuild make sure that ruby respects LDFLAGS as set by user.
With this, also the ruby extensions uses the same LDFLAGS, too (maybe this is not that good, but at least it's an improvement, and follow the same ways of perl).
Note: -Bdirect linking is likely to be useful with dlopening stuff like ruby :)
Created attachment 82888 [details, diff]
I've added a more complex patch now, as -Bdirect breaks when passed to LDFLAGS, but works as extensions' flag.