You can puts
to a file handle, almost the same as if it was STDOUT. A very simple adjustment to your code is to add a File.open
block:
require 'anemone'
File.open('report.txt', 'w') do |file|
Anemone.crawl("http://www.example.com/") do |anemone|
anemone.on_every_page do |page|
file.puts page.url
end
end
end