diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-03-12 15:21:59 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-08-18 12:03:21 -0700 |
commit | 6b4713081fcccede0c9857987e9e3fd47d94c14d (patch) | |
tree | c10ca0d035061edee5b3c39fd9e3ae8377fa7781 /lib/chef/mixin | |
parent | 63a2d95003bc062d251d453d63ab1c5d91cbdb06 (diff) | |
download | chef-6b4713081fcccede0c9857987e9e3fd47d94c14d.tar.gz |
PR feedback
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r-- | lib/chef/mixin/template.rb | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/lib/chef/mixin/template.rb b/lib/chef/mixin/template.rb index 546b76cf80..be83edc697 100644 --- a/lib/chef/mixin/template.rb +++ b/lib/chef/mixin/template.rb @@ -44,71 +44,71 @@ class Chef attr_reader :_extension_modules - def initialize(variables) - super - @_extension_modules = [] - end - - ### - # USER FACING API - ### - - # Returns the current node object, or raises an error if it's not set. - # Provides API consistency, allowing users to reference the node object - # by the bare `node` everywhere. - def node - return @node if @node - # XXX: we include @node even if you explicitly pass vars, so is this warning never reached? - raise "Could not find a value for node. If you are explicitly setting variables in a template, " + - "include a node variable if you plan to use it." - end - # # Helpers for adding context of which resource is rendering the template (CHEF-5012) # # name of the cookbook containing the template resource, e.g.: # test - def cookbook_name - return @cookbook_name if @cookbook_name - end + # + # @return [String] cookbook name + attr_reader :cookbook_name # name of the recipe containing the template resource, e.g.: # default - def recipe_name - return @recipe_name if @recipe_name - end + # + # @return [String] recipe name + attr_reader :recipe_name # string representation of the line in the recipe containing the template resource, e.g.: # /Users/lamont/solo/cookbooks/test/recipes/default.rb:2:in `from_file' - def recipe_line_string - return @recipe_line_string if @recipe_line_string - end + # + # @return [String] recipe line + attr_reader :recipe_line_string # path to the recipe containing the template resource, e.g.: # /Users/lamont/solo/cookbooks/test/recipes/default.rb - def recipe_path - return @recipe_path if @recipe_path - end + # + # @return [String] recipe path + attr_reader :recipe_path # line in the recipe containing the template reosurce, e.g.: # 2 - def recipe_line - return @recipe_line if @recipe_line - end + # + # @return [String] recipe line + attr_reader :recipe_line # name of the template source itself, e.g.: # foo.erb - def template_name - return @template_name if @template_name - end + # + # @return [String] template name + attr_reader :template_name # path to the template source itself, e.g.: # /Users/lamont/solo/cookbooks/test/templates/default/foo.erb - def template_path - return @template_path if @template_path + # + # @return [String] template path + attr_reader :template_path + + def initialize(variables) + super + @_extension_modules = [] + end + + ### + # USER FACING API + ### + + # Returns the current node object, or raises an error if it's not set. + # Provides API consistency, allowing users to reference the node object + # by the bare `node` everywhere. + def node + return @node if @node + raise "Could not find a value for node. If you are explicitly setting variables in a template, " + + "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. |