Skip to content
Extraits de code Groupes Projets
Valider 135ebb75 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

Merge branch 'master' of github.com:diaspora/diaspora

parents ec9e180e 7e8bf40a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module Diaspora
def self.bone(user)
exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML)
exporter.execute(user)
end
class Exporter
def initialize(strategy)
self.class.send(:include, strategy)
end
end
module Exporters
module XML
def execute(user)
builder = Nokogiri::XML::Builder.new do |xml|
xml.user {
xml.username user.username
xml.serialized_private_key user.serialized_private_key
xml.person user.person.to_xml
xml.aspects {
user.aspects.each do |aspect|
xml.aspect {
xml.id_ aspect.id
xml.name aspect.name
xml.people {
aspect.people.each do |person|
xml.person person.to_xml
end
}
xml.posts {
aspect.posts.each do |post|
xml.post post.to_xml if post.respond_to? :to_xml
end
}
}
end
}
}
end
# This is a hack. Nokogiri interprets *.to_xml as a string.
# we want to inject document objects, instead. See lines: 25,35,40.
# Solutions?
CGI.unescapeHTML(builder.to_xml.to_s)
end
end
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter