Skip to content

Instantly share code, notes, and snippets.

@vpacher
Created October 21, 2011 17:52
Show Gist options
  • Select an option

  • Save vpacher/1304475 to your computer and use it in GitHub Desktop.

Select an option

Save vpacher/1304475 to your computer and use it in GitHub Desktop.
require 'net/http'
res = Net::HTTP.get URI.parse("http://www.securetrading.com/exchangerates/curr-gbp-ns-today.txt")
f = 1/10000000.0
p res.map(&:chomp).inject({}) { |hash, line| e = line.split; hash[e[0]] = e[1].to_i * f if e[1]; hash}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment