I was able to develop the following solution to my question:
ax = gca;
xlim([0, 3]) % Create an axes with x in [0, 3]. This has ticks at every 0.5.
% Hide non-integer ticks.
% Setup a callback to handle when the limits change.
ax.XAxis.LimitsChangedFcn = @removeNonintegerTicks;
% Make ruler value mode automatic, momentaryily, (if it isn't already)
% so that the location of the tick marks are recomputed.
ruler.TickValuesMode = 'auto';
% Now, hide any tick marks that are not integers.
tick_values = ruler.TickValues;
% Sometimes the '0' tick mark is off by ~1e-17, so we use a small range of
integer_indices = abs(fix(tick_values) - tick_values) < 1e-12;
% Keep only the (approximately) integer values.
ruler.TickValues = tick_values(integer_indices);