Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.
/ changer Public archive

Small gem I created to cement the process of creating and publishing a rubygem

Notifications You must be signed in to change notification settings

JWhist/changer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Changer

Install

Install using gem install changer Register with Rapidapi.com and set your ENV variable 'RAPID_API_KEY' to your X-RapidAPI-Key value.

Currency Objects

Currency objects are created using Currency.new(:sym, amount) where :sym is the type (:usd) and amount is the value (2.99)

Conversion

Conversion can be done in place with the bang methods, or return new objects with the regular methods convert, and convert_at. Convert will fetch the rate from exchangerates API, while convert_at will use the rate given in the parameter

Currency Math

The math operator methods will handle conversion prior to completing the math operation, and return a value in the type of the calling object. For instance, adding US Dollars and Canadian Dollars will return a value in US Dollars, while adding Canadian Dollars to US Dollars will return Canadian Dollars. These methods can be chained ie; USD 3.00 + GBP 2.90 - CAD 6.00 = USD xx.xx

About

Small gem I created to cement the process of creating and publishing a rubygem

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages