Set the ball and the barrier about two feet apart on the table. Grasp both ends of the ruler. Push the ball using the center of the ruler so the ball rolls, hits the barrier, and rebounds from it. Describe the motion of the ball as it moves.
When an object, in your example, a ball, rolls (with rolling friction) bounces off of another surface, the force from the barrier is transferred into the ball causing it to roll back. (Newton’s third law)