a) The method works because placing the ruler on the surface of the mirror guarantees that it is parallel to the mirror. The source and destination of the light ray is your pupil, so the ray is guranteed to be perpendicular to the mirror and the ruler.
b) The plane of your pupils needs to be parallel to the mirror/ruler. This is easy to judge as your eyes will be relaxed and looking straight ahead at your own reflection in the mirror. If your eyes are looking left or right you need to turn your head so you are looking straight ahead. People are generally pretty good at judging "straight ahead", so chances are that you are doing this correctly.
Satisfying the above two constraints means the geometry gives an accurate measurement, probably more accurate than an optometrist can judge by holding a ruler up to your eyes and trying to guesstimate that they have no parallax error.
a) The method works because placing the ruler on the surface of the mirror guarantees that it is parallel to the mirror. The source and destination of the light ray is your pupil, so the ray is guranteed to be perpendicular to the mirror and the ruler.
b) The plane of your pupils needs to be parallel to the mirror/ruler. This is easy to judge as your eyes will be relaxed and looking straight ahead at your own reflection in the mirror. If your eyes are looking left or right you need to turn your head so you are looking straight ahead. People are generally pretty good at judging "straight ahead", so chances are that you are doing this correctly.
Satisfying the above two constraints means the geometry gives an accurate measurement, probably more accurate than an optometrist can judge by holding a ruler up to your eyes and trying to guesstimate that they have no parallax error.