A simple Ruby gem to deal with the nightmare that is Banxico
Add this line to your app's Gemfile:
gem 'Cochimetl'Then you can just run:
$ bundleOr install it yourself with:
gem install Cochimetl
I tried to keep it simple, for example, to make a new currency object in pesos just use:
Cochimetl.new(1, :mxn)You can do any basic arithmetic with your currency object:
currency = Cochimetl.new(1, :mxn)
currency * 2 # currency.value * 2
currency + 1 # currency.value + 1
currency.value # 3Oh, you can also exchange the value to any of the supported currencies:
currency.to(:usd)In case you need a refresher on which currencies are supported, you can easily check with:
Cochimetl.currenciesThat pretty much covers it!
- Create a fork.
- Make your own feature branch like this:
git checkoyt -b feature/my-cool-feature - Make sure to add some nice specs to your work!
- Commit your changes
git commit -am "Add some cool changes" - Push the branch like this
git push origin feature/my-cool-feature - You can create a pull request to this repo!
Made with ❤️