Class: BitConverter::Convert

Inherits:
Object
  • Object
show all
Defined in:
lib/bit_converter/convert.rb

Class Method Summary collapse

Class Method Details

.convert(amount:, from:, to:) ⇒ Object



8
9
10
# File 'lib/bit_converter/convert.rb', line 8

def convert(amount:, from:, to:)
  rate_of(to.upcase) / rate_of(from.upcase) * amount
end

.pretty_convert(amount:, from:, to:) ⇒ Object



12
13
14
15
16
# File 'lib/bit_converter/convert.rb', line 12

def pretty_convert(amount:, from:, to:)
  result = convert(amount: amount, from: from, to: to)

  helper.number_to_currency(result, unit: "")
end