class Adaptation::Adaptor def publish *options message_object = nil if options.first.is_a?(Adaptation::Message) message_object = options.first elsif options.first.is_a?(String) xml_message = options.first message_type = xml_message[1..(xml_message.index(/(>| )/) - 1)] message_class = Adaptation::Message.get_class_object(message_type.capitalize) message_object = message_class.new(xml_message) end mom = File.new(ADAPTOR_ROOT + '/test/mocks/test/mom.txt', "a") mom.write("#{message_object.to_xml.to_s}\n") mom.close end end