Module: Monefy::Converter
- Included in:
- Monefy
- Defined in:
- lib/monefy/converter.rb
Overview
Encapsulate all the logic to convet currencies
Instance Method Summary collapse
-
#convert_to(to_currency) ⇒ Monefy
Converts a Monefy instance froma a currency to another.
Instance Method Details
#convert_to(to_currency) ⇒ Monefy
Converts a Monefy instance froma a currency to another.
14 15 16 17 18 19 20 21 22 |
# File 'lib/monefy/converter.rb', line 14 def convert_to(to_currency) validate_currency(to_currency) calculated_amount = convert_currency(currency, amount, to_currency) create_new_instace( calculated_amount, to_currency ) end |