Slice-polynomial functions and twistor geometry of ruled surfaces in $$\mathbb {CP}^3$$CP3