def partial(template, *args)
options = args.extract_options!
options.merge!(:layout => false)
if collection = options.delete(:collection) then
collection.inject([]) do |buffer, member|
buffer << erb(template, options.merge(:layout =>
false, :locals => {template.to_sym => member}))
end.join("\n")
else
erb(template, options)
end
end
This method has no docs. It seems to be some way of letting you add additional features to partial rendering in an erb template.
How does this Ruby code work?
I don't care as much about the role this plays in a web framework. I just would like to understand what's going on in terms of Ruby syntax.