A Ruler is a hard, long device, designed for measuring relatively short distances. It can be flat, thicker or even square.
Specific terms like yardstick refer to a specific length.
This name applies to the practice of using a ruler as a convenient, hence in some - mainly school - traditions popular, tool of the pervertible category for a corporal punishment by beating, usually on the hands (either outstretched palms or knuckles) or thighs, sometimes a spanking (i.e. on the buttocks).
Generally, solid, heavy wooden or metal rulers are used for these purposes, but lighter, often flexible plastic ones can also be used punitively. Thus the wooden regla (Spanish for ruler) was widely used in schools to punish pupils: the 12" one (sometimes called a ferule) was applied to the hands, the yard long one (made for drawing in the blackboard; rather like a yardstick, but doubling as a pointer) amd as a rod for spanking.
Kneeling on a ruler
A more passive school punishment consisted in ordering a pupil to kneel (considered a humiliating position), often with bare legs and knees (again considered humiliating), on a solid, thick ruler, which quickly starts to hurt the knees as the whole body weight rests on one side (in fact mostly the edge at the pupil's side) of the ruler, becoming ever more painful as the exercise progresses.