Here's the problem...
I have a method that I'm calling to strip out characters and convert strings to floats.
def convert_to_float(currency)
return currency.gsub(/regex/, "").to_f
end
I have another method that is receiving string values. What I'm wanting to do is iterate those received strings through the convert_to_float method instead of applying the gsub to each line. Here is what I've got... is this even possible with the way I'm doing this?
def verify_amounts(total,subtotal,tax)
arrayoftotals = [total,subtotal,tax]
arrayoftotals.each do |convert_to_float|
end
ftotal = arrayoftotals[0]
raise "ftotal must be a Float" unless ftotal.kind_of? Float
end
So far its raising the fault stating that the type is not a float which is telling me that the do each loop isn't converting the values.
Help.
Thanks!!!