Ah! Thank you! That’s what I get for copy/pasting code from other examples without truly understanding it. I found the rotate logic in another topic (Rotate object in ruby script - #6 by McGordon) and didn’t realize what I was doing. Thank you
replacing it this way makes it work as one would expect
rv = Z_AXIS if axis == "z"
rv = Y_AXIS if axis == "y"
rv = X_AXIS if axis == "x"