Skip to content

Instantly share code, notes, and snippets.

@stevemorris
Created September 23, 2011 05:11
Show Gist options
  • Save stevemorris/1236786 to your computer and use it in GitHub Desktop.
Save stevemorris/1236786 to your computer and use it in GitHub Desktop.
Compare currency data sets
# Here's a hack I wrote to verify the currency hash loaded by the current Ruby Money gem is the same as
# the hash loaded via JSON in my fork of the gem.
# To run this script:
# 1. clone my fork with git clone https://github.com/stevemorris/money, and cd to the root of the project
# 2. download currency.rb from master to the root of the fork by running the command:
# curl -O https://raw.github.com/RubyMoney/money/master/lib/money/currency.rb
# 3. run this script from the root of the fork. the script should print 'true'. you can ignore the
# warning about TABLE already being initialized.
# 4. make a change to the TABLE hash in the currency.rb file you downloaded. then rerun the script and
# verify that it now prints 'false'
require_relative 'currency.rb'
original_table = eval('Money::Currency::TABLE')
require_relative 'lib/money/currency_loader'
require_relative 'lib/money/currency'
new_table = eval('Money::Currency::TABLE')
p original_table.eql?(new_table)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment