Sha256: b8a2654899a75ca7d7e35d8a6c0200886285642d67f4daa7f5f911db1f0f7099
Contents?: true
Size: 499 Bytes
Versions: 12
Compression:
Stored size: 499 Bytes
Contents
require 'htmlentities' # # We are opening up Exception and adding to_xml and to_json. # class Exception def exception_type self.class.to_s ? self.class.to_s.split("::").last : 'None' end def to_xml "<errors><error>#{HTMLEntities.new.encode(self.message)}</error><type>#{self.exception_type}</type></errors>" end def to_json "{\"error\":#{ActiveSupport::JSON.encode(self.message.gsub(/\r/, ' ').gsub(/\n/, ' ').squeeze(' '))}, \"type\":\"#{self.exception_type}\"}" end end
Version data entries
12 entries across 12 versions & 1 rubygems