My observations (That may, or may not be correct) with him snapping to the ledge seem to be:
He'll always snap if you're facing the ledge when you up-b, and rub up against it going up or down. If you don't rub it, he won't snap.
He'll always snap if you're holding towards the ledge, and he's reached the point when he starts to slow down from the jump. This one he seems to do by being close to it, not necessarily rubbing it.
He'll never snap, if you're facing away from the ledge when you up-B, regardless of what you press, until he starts to slow down again, and cease snapping once he's flying downwards full speed. You will have to cancel this one.
Again, not sure if that's right or not. But its what I've noticed.