In the Illustrator Preferences or current document settings (Document Setup → Units) you set the ruler units. Document units do not affect global preferences, but changing global units will change document settings. In the DOM, the activeDocument.rulerUnits property returns the current units from the list: RulerUnits.Pixels, RulerUnits.Millimeters, and so on…