It looks like you use symbol in the place where a string should be put into.
Because the information is limited. Try change:
File.open(domain , "w") { |file| file.write(email) }
to
File.open(domain.to_s , "w") { |file| file.write(email) }
and
File.open(domain , "w") { |file| file.write(email.to_s) }
Or add "to_s" to both "domain"
and "email"
to check which one is correct then you might know which part is wrong.