class CSVConverter::Converters::StringConverter

Cleans up a string

Public Instance Methods

call() click to toggle source

Cleans up the data string. @return [String] if data is empty returns an empty string.

# File lib/csv_converter/converters/string_converter.rb, line 9
def call
  call!
rescue CSVConverter::Error
  nullable_object
end
call!() click to toggle source

Cleans up the data string. @return [String] if data is empty an error is raised.

# File lib/csv_converter/converters/string_converter.rb, line 17
def call!
  raise ArgumentError, 'no data provided' if data.blank?

  data
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/string_converter.rb, line 27
def nullable_object
  ''
end