Alignment of nematic liquid crystals on ruled grating surfaces