Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby
require 'net/http'
def convert_currency(from_curr, to_curr)
doc = Net::HTTP.get('', "/finance/converter?a=1&from=#{from_curr}&to=#{to_curr}")
regexp ="(\\d+\\.{0,1}\\d*)\\s+#{to_curr}")
regexp.match doc
puts "1 USD = #{convert_currency('USD', 'EUR')} EUR"

This comment has been minimized.

Copy link

huykon commented Jun 23, 2018

not working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.