Methods

DataMapper::Serializer::ValidationErrors::ToCsv

Public Instance Methods

to_csv(*args) click to toggle source
# File lib/dm-serializer/to_csv.rb, line 34
def to_csv(*args)
  options = args.first || {}
  options = options.to_h if options.respond_to?(:to_h)
  options[:writer] = '' unless options.has_key? :writer

  CSV.generate(options[:writer]) do |csv|
    errors.each do |key, value|
      value.each do |error|
        row = []
        row << key.to_s
        row << error.to_s
        csv << row
      end
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.