write file to date

This commit is contained in:
Nemo 2018-03-30 13:50:03 +05:30
parent 3a0545d053
commit 272053df38
1 changed files with 2 additions and 1 deletions

View File

@ -1,9 +1,10 @@
require 'nokogiri'
require 'csv'
require 'date'
restaurants = []
CSV.open('database.csv', 'wb') do |csv|
CSV.open("#{Date.today.to_s}.csv", 'wb') do |csv|
csv << ['url', 'title', 'location', 'address', 'cuisine']
Dir.glob('html/restaurants-*.html') do |file|
page = Nokogiri::HTML(open(file))