Why does a ruler continue to slide after toppling? I was playing with a small ruler by repeatedly toppling it, see diagram below:

The ruler, standing $h$ tall and approximately a regular bar, is prevented from free-rotating by a fixed ridge (a book, usually) in point $O$ and then allowed to topple until it hits the $xz$-plane. My desk and the ruler both have quite smooth, hard surfaces and I can't help noticing that after impact the ruler slides along the surface in the $x$-direction for a bit until it is halted by friction.
This suggests the ruler had momentum in the $x$-direction, after impact with the desk's surface. But I can't work out where it comes from. Is some of the rotational kinetic energy the ruler acquired during toppling converted to translational kinetic energy on impact? If so, how?
The forces acting on the centor of gravity of the ruler are shown in the right hand top corner of the diagram. Obviously it's the moment $\frac{Th}{2}$ that's causing rotation around $O$ and the equation of motion is:
$$\frac{Th}{2}=I\ddot{\theta}.$$
With:
$$T=mg\sin\theta.$$
And:
$$\ddot{\theta}=\omega\frac{\mathrm{d} \omega}{\mathrm{d} \theta}.$$
So:
$$\frac{mgh}{2}\sin\theta \mathrm{d}\theta=I\omega \mathrm{d}\omega.$$
Integrated between $0,0$ and $\frac{\pi}{2},\omega$, we get:
$$K=\frac{I\omega^2}{2}=\frac{mgh}{2}.$$
$\frac{mgh}{2}$ is of course simply the amount of potential energy that has been converted to kinetic energy by lowering the CoG from $h/2$ to $0$.
Now let's look at point $O$:

In $O$, $mg\cos\theta$ has to be countered to prevent the ruler from moving radially (from $O$ to the CoG or vice versa).
Decomposing we get:
$$F_x=mg\cos\theta \sin\theta.$$
But at $\theta=\pi /2$, $F_x$ vanishes, so it can't be that force that's responsible for any horizontal motion.
Clearly I'm missing something here, but what is it?
 A: As noted by John Rennie in the comments, there will be a point as the ruler falls where it loses contact with the ridge and begins to slide to the right.  The idea here is that if the ruler were to keep its pivot point fixed, then at some point, the force applied by the pivot point would have to switch from having a component to the right to having a component to the left (i.e., pulling the CM back in rather than pushing it out.)  Since the "ledge" specified in the OP can only exert a force to the right, this will be the point that the base of the ruler begins to slide away from the ledge.  (This is similar in spirit to the classic "disc slides down a frictionless hemisphere" problem.)
To prove this, we use conservation of energy to find the ruler's angular velocity as a function of $\theta$.  This becomes
$$
\frac{1}{2} I \omega^2 = mg \frac{h}{2} ( 1- \cos \theta) \quad \Rightarrow \quad \frac{1}{3} h^2 \omega^2 = gh (1 - \cos \theta) \quad \Rightarrow \quad \omega^2 = \frac{3g}{h}(1 - \cos \theta). 
$$
Taking the derivative of both sides with respect to time, we get
$$
2 \omega \alpha = \frac{3 g}{h} \sin \theta \omega \quad \Rightarrow \quad \alpha = \frac{3gh}{2} \sin \theta 
$$
The linear acceleration of the center of mass is therefore
$$
\vec{a} = \frac{h}{2} (- \omega^2 \hat{r} + \alpha \hat{\theta}) = - \frac{3g}{2}(1 - \cos \theta) \hat{r} + \frac{3g}{4} \sin \theta \hat{\theta}
$$
using polar coordinates (with $\theta = 0$ at the vertical and increasing clockwise.) In terms of the Cartesian components, we have $\hat{r} = \cos \theta \hat{y} + \sin \theta \hat{x}$ and $\hat{\theta} = \cos \theta \hat{x} - \sin \theta \hat{y}$, so all told this becomes
\begin{align*}
\vec{a} &= - \frac{3g}{2}(1 - \cos \theta) (\cos \theta \hat{y} + \sin \theta \hat{x}) + \frac{3g}{4} \sin \theta (\cos \theta \hat{x} - \sin \theta \hat{y}) \\
&= \frac{3g}{2}\left((\cos \theta - 1)  + \frac{1}{2} \cos \theta \right) \sin \theta\hat{x} + \frac{3g}{2}\left((\cos \theta - 1) \cos \theta - \frac{1}{2} \sin^2 \theta \right) \hat{y}.
\end{align*}
We see that $a_x = 0$ when $\frac{3}{2} \cos \theta - 1 = 0$, or $\cos \theta = \frac{2}{3}$, or $\theta \approx 48.2^\circ$. Thus, once the ruler falls past this angle, the net force on center of mass must be to the left to keep it moving in a circular arc.  On a perfectly frictionless table, the ruler would leave the "ledge" at this point, since the ledge is unable to provide a force in this direction.  In reality, friction might be able to hold the bottom of the ruler in place for a bit longer than this, making the angle at which the ruler leaves the ledge much closer to the horizontal.
A: OK, since it's a quiet Friday evening in and since I'm allegedly an experimental scientist I videoed my ruler while it was falling. My phone doesn't do slow motion (it probably does and I just don't know how to work it!) so the time resolution is limited, but here are four successive frames from the video.




It should be obvious that the bottom edge of the ruler does leave the object it is resting against. I've drawn a red line on the images to show this, though I'm not sure how clear it is in these pictures. The frame rate is 30 fps, so the pictures shown cover only 0.1 seconds. I think this is too short a time for the eye to follow the motion of the bottom edge of the ruler. I could not see the bottom edge moving away when just watching the ruler fall. In fact I was a bit surprised to see it on the video.
I note that the ruler starts to move away between around 45° to 30° to the horizontal, which tallies quite nicely with Michael's estimate of 41.8°.
