Изтрит обнови решението на 08.10.2015 00:08 (преди над 9 години)
+CURRENCIES_TO_BGN = {usd: 1.7408, eur: 1.9557, gbp: 2.6415, bgn: 1}
+
+def convert_to_bgn(price, currency)
+ (price * CURRENCIES_TO_BGN[currency]).round(2)
+end
+
+def compare_prices(first_price, first_currency, second_price, second_currency)
+ first_amount = convert_to_bgn(first_price, first_currency)
+ second_amount = convert_to_bgn(second_price, second_currency)
+
+ first_amount - second_amount
+end
Става :) само не е много ясно защо вадиш двете числа, но и така става, но виж за алтернатива.
Изтрит профил.