class CSVConverter::Converters::FloatConverter
Converts a string into a float
Public Instance Methods
call()
click to toggle source
Converts data into a Float. If the decimal separator is a comma it is replaced by a period before parsing. @return [Float] if an error occurs during conversion nil is returned.
# File lib/csv_converter/converters/float_converter.rb, line 10 def call call! rescue CSVConverter::Error nullable_object end
call!()
click to toggle source
Converts data into a Float. If the decimal separator is a comma it is replaced by a period before parsing. @return [Float] if an error occurs during conversion an error is raised.
# File lib/csv_converter/converters/float_converter.rb, line 19 def call! Float(data.sub(',', '.')) rescue StandardError => e raise CSVConverter::Error.new(e.message, options) end
Private Instance Methods
nullable_object()
click to toggle source
# File lib/csv_converter/converters/float_converter.rb, line 27 def nullable_object nil end