Sha256: 94b5c7c0838da853ebaabde67297da1c6ed442a767c6ba1e6b64443938d47cfb

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

require 'builder'
require Ruboss4Ruby::LIB_DIR + 'configuration'

module DataMapper
  module Validate
    class ValidationErrors
      def to_xml
        xml = Builder::XmlMarkup.new(:indent => 2)
        xml.instruct! :xml, :version => "1.0", :encoding => "UTF-8"
        xml.errors do |e|
          @errors.each_key do |attribute|
            @errors[attribute].each do |msg|
              next if msg.nil?
              if attribute == "base"
                e.error("message" => msg)
              else
                e.error("field" => attribute.to_s.camelcase(:lower), "message" => msg)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dima-ruboss4ruby-1.1.0 lib/ruboss4ruby/datamapper_foo.rb