# # A simple ruby script to convert currency # can be edited to check stocks, highs, lows, etc. # # Written by: Steve at r3lax.com # # Usage: money.rb# Where: , # # MUST BE CONNECTED TO THE INTERNET # Must have ruby-finance installed require 'finance/currency' #Take arguments in from command line c = ARGV #Ensure that usage is proper valid = /^([\+-]?\d*(?:\.\d*)?)(\S+)\s(\S+)/ if exchange = valid.match(c) amount = exchange[1] from_code = exchange[2] to_code = exchange[3] #Let Finance::Currency do its magic puts Finance::Currency::convert(to_code.to_s, from_code.to_s, amount) else #if usage is invalid - inform the user puts '-----USAGE IS-----' puts '-- ISO Currency codes ' puts ' , ' end-- ISO Currency codes