A note on a generalization of a $q$-series transformation of Ramanujan