Class: DataMapper::Validate::ValidationErrors
- Inherits:
-
Object
- Object
- DataMapper::Validate::ValidationErrors
- Defined in:
- lib/dm-serializer/to_csv.rb,
lib/dm-serializer/to_xml.rb,
lib/dm-serializer/to_json.rb,
lib/dm-serializer/to_yaml.rb
Instance Method Summary collapse
- #to_csv(writer = '') ⇒ Object
- #to_json(*args) ⇒ Object
- #to_xml(opts = {}) ⇒ Object
- #to_yaml(*args) ⇒ Object
Instance Method Details
#to_csv(writer = '') ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dm-serializer/to_csv.rb', line 44 def to_csv(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 |
#to_json(*args) ⇒ Object
85 86 87 |
# File 'lib/dm-serializer/to_json.rb', line 85 def to_json(*args) errors.to_hash.to_json end |
#to_xml(opts = {}) ⇒ Object
73 74 75 |
# File 'lib/dm-serializer/to_xml.rb', line 73 def to_xml(opts = {}) to_xml_document(opts).to_s end |
#to_yaml(*args) ⇒ Object
52 53 54 |
# File 'lib/dm-serializer/to_yaml.rb', line 52 def to_yaml(*args) errors.to_hash.to_yaml(*args) end |