Module: DataMapper::Serializer::ValidationErrors::ToCsv
- Included in:
- Validations::ValidationErrors
- Defined in:
- lib/dm-serializer/to_csv.rb
Instance Method Summary collapse
Instance Method Details
#to_csv(*args) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dm-serializer/to_csv.rb', line 34 def to_csv(*args) = args.first || {} = .to_h if .respond_to?(:to_h) [:writer] = '' unless .has_key? :writer CSV.generate([: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 |