%= should do it, but in your case you might have to add a bit of extra code since it loops back at 0 not to 1.
Something like this.
value = 0
for i in 0...20
value += 1
value %= 7
value = [value, 1].max
p value
end
Of course you would have to apply it to your own example.
@chant_window.fragment += 1
@chant_window.fragment %= 7
@chant_window.fragment = [@chant_window.fragment, 1].max
The extra code at the end is because your minimum value is 1.
I hope this helps you out.
Have a nice day.