Skip to content

Instantly share code, notes, and snippets.

@xenda
Created March 3, 2010 12:18
Show Gist options
  • Save xenda/320569 to your computer and use it in GitHub Desktop.
Save xenda/320569 to your computer and use it in GitHub Desktop.
module Analyze
def load_visits(filename="Visitas26")
filename << ".txt"
visits = File.read(filename)
visits = visits.split("\r")
visits = visits[1..-1]
array = visits.map do |visit|
url, visits, timestamp = visit.split("\t")
post_id = url.split("/").last
blog_id =url.split("/")[2]
Track.create({:blog_id=>blog_id,:post_id=>post_id})
[blog_id,post_id,visits]
end
end
end
include Analyze
puts process.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment