For example, if I want 987 to equal "900".
n = 987 m = 2 n.floor(-m) #=> 900
See Integer#floor: "When the precision is negative, the returned value is an integer with at least ndigits.abs trailing zeros."
ndigits.abs
or
(n / 10**m) * 10**m #=> 900