Reliably handling ruby detection at runtime