summaryrefslogtreecommitdiff
path: root/lib/chef/mixin/template.rb
diff options
context:
space:
mode:
authorAndrea Campi <andrea.campi@zephirworks.com>2012-12-13 00:17:55 +0100
committerBryan McLellan <btm@opscode.com>2012-12-14 11:10:28 -0800
commit3f4ac67307490211cb767c3331754e41f3068892 (patch)
tree670baeb561ba51a14f33b71e218f1760f222c657 /lib/chef/mixin/template.rb
parentcb34e80c908e5379f3c35e35901b033125d04d54 (diff)
downloadchef-3f4ac67307490211cb767c3331754e41f3068892.tar.gz
[CHEF-3249] Add documentation on rendering partials.
Diffstat (limited to 'lib/chef/mixin/template.rb')
-rw-r--r--lib/chef/mixin/template.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/chef/mixin/template.rb b/lib/chef/mixin/template.rb
index deaf66a509..4557c50136 100644
--- a/lib/chef/mixin/template.rb
+++ b/lib/chef/mixin/template.rb
@@ -30,6 +30,29 @@ class Chef
"include a node variable if you plan to use it."
end
+ #
+ # Takes the name of the partial, plus a hash of options. Returns a
+ # string that contains the result of the evaluation of the partial.
+ #
+ # All variables from the parent template will be propagated down to
+ # the partial, unless you pass the +variables+ option (see below).
+ #
+ # Valid options are:
+ #
+ # :local:: If true then the partial name will be interpreted as the
+ # path to a file on the local filesystem; if false (the
+ # default) it will be looked up in the cookbook according to
+ # the normal rules for templates.
+ # :source:: If specified then the partial will be looked up with this
+ # name or path (according to the +local+ option) instead of
+ # +partial_name+.
+ # :cookbook:: Search for the partial in the provided cookbook instead
+ # of the cookbook that contains the top-level template.
+ # :variables:: A Hash of variable_name => value that will be made
+ # available to the partial. If specified, none of the
+ # variables from the master template will be, so if you
+ # need them you will need to propagate them explicitly.
+ #
def render(partial_name, options = {})
raise "You cannot render partials in this context" unless @template_finder