On Tuesday, November 13, 2012 at 4:26 PM, Andrea Campi wrote:
Just for kicks, I spent an hour tonight trying to figure out how complicated this would be.This is just a proof of concept, but the spec is green.It would probably another 1-2 hours to prepare a proper pull request. Unless this is deemed *too* crazy, of course ;)
Attachments:- 0001-Quick-and-dirty-implementation-of-render-partial-in-.patchOverall it's the right direction.Some questions:* Is there value in having the #render method take either a Hash or String to select which partial to render? Why not just have the method signature be: render(partial_name, variables_as_a_hash=nil)? If variables_as_a_hash was given, you replace the current context variables with a the specified set, otherwise keep them the same.
* Following from the above, is there any need to support running partials from different cookbooks than the template that's being rendered? Or from an on-disk (`local true`) template? This would lead you to a method/option signature likerender("partial_name", :variables => {:foo => "bar"}, :cookbook => "other-cookbook", :local => true, :source => "/var/mytemplates/partial.conf.erb")
* Is there value in the leading underscore in partial names? This will be natural for Rails people, and yet another thing to learn for everyone else. Does it make it easier to look at your cookbooks and figure out what's going on if the partials look different?
Archive powered by MHonArc 2.6.16.