Secret : The envelope has been secretly prepared with a slit in one of the corners. The ruler passes through that slit and is hidden in your sleeve, or behind your hand, the rest of the ruler is in the envelope. You open the flap and pull out the ruler.
Performance Tip : To make this seem even more impossible lay the ruler on top of the envelope to emphasize that it could not possibly fit inside. Be sure to lay the slit down.