Class: Convertio::Converter
- Inherits:
-
Object
- Object
- Convertio::Converter
- Defined in:
- lib/convertio.rb
Overview
This class validates input and performs conversion
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(value, from, to) ⇒ Converter
constructor
A new instance of Converter.
Constructor Details
Instance Method Details
#convert ⇒ Object
104 105 106 |
# File 'lib/convertio.rb', line 104 def convert (@value * @from_unit[:per_base]) / @to_unit[:per_base].to_f end |