Skip to content

Instantly share code, notes, and snippets.

@tarcieri
Created July 21, 2011 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarcieri/1096754 to your computer and use it in GitHub Desktop.
Save tarcieri/1096754 to your computer and use it in GitHub Desktop.
Xml:posts do
lists:each(Posts) do |Post|
Xml:post do
Xml:title(Post#post.title),
Xml:body(Post#post.body),
Xml:published_at(Post#post.published_at),
Xml:comments do
lists:each(Post#post.comments) do |Comment|
Xml.comment do
Xml:body(Comment#comment.body)
end
end
end
end
end
end
Xml:posts(fun() ->
lists:each(fun(Post) ->
Xml:post(fun() ->
Xml:title(Post#post.title),
Xml:body(Post#post.body),
Xml:published_at(Post#post.published_at),
Xml:comments(fun() ->
lists:each(fun(Comment) ->
Xml.comment(fun() ->
Xml:body(Comment#comment.body)
end)
end, Post#post.comments)
end)
end)
end, Posts)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment