class FxPotato::RateCalculator

Public Class Methods

calculate(base, target) click to toggle source
# File lib/fxpotato/rate_calculator.rb, line 3
def self.calculate(base, target)
  return nil unless base && numeric?(base) && target && numeric?(target)
  target / base
end
numeric?(thing) click to toggle source
# File lib/fxpotato/rate_calculator.rb, line 8
def self.numeric?(thing)
  Float(thing) != nil rescue false
end