Cut each N symbol from array
Your code

You have a sneaky bug in your code!

1000/2.times {|i| puts i }


You seem to think that this code would display 500 numbers between 0 and 499.
It doesn't. Instead, it displays 0, 1, and returns 500.

You need to replace str.length/n.times do with (str.length/n).times do.

Alternative

You can use gsub to look for the substrings, chop them and replace them:

def delete_every_nth_char(string, n)
  string.gsub(/.{#{n}}/){ |sub| sub.chop }
end

delete_every_nth_char('1234A1234B1234C', 5)
# "123412341234"
delete_every_nth_char('ABAB', 2)
# "AA"
delete_every_nth_char('ABA', 2)
# "AA"
delete_every_nth_char('ABA', 1)
# ""
delete_every_nth_char('ABA', 5)
# "ABA"


It is concise and probably faster than splitting and joining the strings manually.