When the ruler is broughı near the inetal knob, it repels electrons in the metal. Electrons move away froni the ruler and down the metal rod. The knob now has a positive charge. The thin pieces of metal foil at the bottom of the metal rod now have a negative charge.
So, when a ruler that is negatively charged touches a metal rod then the metal rod also becomes negatively charged because of conduction process. This is because negative charge moves from the rules towards the metal rod and hence, it spreads over to the metal rod.