Class: ChefSpec::Renderer
- Inherits:
-
Object
- Object
- ChefSpec::Renderer
- Includes:
- Normalize
- Defined in:
- lib/chefspec/renderer.rb
Instance Attribute Summary collapse
- #chef_run ⇒ Chef::Runner readonly
- #resource ⇒ Chef::Resource readonly
Instance Method Summary collapse
-
#content ⇒ String?
The content of the resource (this method delegates to the) various private rendering methods.
-
#initialize(chef_run, resource) ⇒ Renderer
constructor
Create a new Renderer for the given Chef run and resource.
Methods included from Normalize
Constructor Details
#initialize(chef_run, resource) ⇒ Renderer
Create a new Renderer for the given Chef run and resource.
25 26 27 28 |
# File 'lib/chefspec/renderer.rb', line 25 def initialize(chef_run, resource) @chef_run = chef_run @resource = resource end |
Instance Attribute Details
#chef_run ⇒ Chef::Runner (readonly)
12 13 14 |
# File 'lib/chefspec/renderer.rb', line 12 def chef_run @chef_run end |
#resource ⇒ Chef::Resource (readonly)
15 16 17 |
# File 'lib/chefspec/renderer.rb', line 15 def resource @resource end |
Instance Method Details
#content ⇒ String?
The content of the resource (this method delegates to the) various private rendering methods.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/chefspec/renderer.rb', line 38 def content case resource_name(resource) when :template content_from_template(chef_run, resource) when :file content_from_file(chef_run, resource) when :cookbook_file content_from_cookbook_file(chef_run, resource) else nil end end |