Answer
The rules is frictionally charged. Humidity in the air introduces polar water molecules to the ruler, however, which conducts charge away.
Work Step by Step
See the diagram.
The plastic ruler is electrically charged. When you place it near small bits of paper, it polarizes the molecules of the paper. Within the paper molecules, the charges that are the same sign as the ruler are repelled and shift farther away. The ruler is then attracted to the opposite charges within the paper that are closer to it. This force can be stronger than gravity.
On a humid day, the polar water molecules are attracted to the ruler (and to a lesser degree, the polarized paper). The moisture serves as a conductor that allows charge to leave the ruler.