Created
March 11, 2013 13:40
-
-
Save orend/5134300 to your computer and use it in GitHub Desktop.
Streaming with csv, from ruby tapas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
def memstats | |
size = `ps -o size= #{$$}`.strip.to_i | |
end | |
memstats #4900 | |
CSV.open('visitors.csv', headers: true) do |csv| | |
visitors = csv.each # Enumerator | |
memstats # 5164 | |
visitors.count{|v| v['Geolocation'] =~ /San Francisco/} | |
end | |
memstats #5164 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment