Using Hashes to Memoize #
Another stellar realization from Mauricio:
iptocountry = Hash.new do |h,ip|
h[ip] = `geoiplookup #{ip}`.chomp.gsub(/^GeoIP Country Edition: /,"")
end
iptocountry.update Marshal.load(File.read("geo.cache")) rescue nil
Want to know what it does?
Continue to full post. (216 words)

