class Chef::FileContentManagement::ContentBase

Attributes

current_resource[R]
logger[R]
new_resource[R]
run_context[R]

Public Class Methods

new(new_resource, current_resource, run_context, logger = Chef::Log.with_child) click to toggle source
# File lib/chef/file_content_management/content_base.rb, line 28
def initialize(new_resource, current_resource, run_context, logger = Chef::Log.with_child)
  @new_resource = new_resource
  @current_resource = current_resource
  @run_context = run_context
  @tempfile_loaded = false
  @logger = logger
end

Public Instance Methods

tempfile() click to toggle source
# File lib/chef/file_content_management/content_base.rb, line 36
def tempfile
  # tempfile may be nil, so we cannot use ||= here
  if @tempfile_loaded
    @tempfile
  else
    @tempfile_loaded = true
    @tempfile = file_for_provider
  end
end

Private Instance Methods

file_for_provider() click to toggle source

Return something that looks like a File or Tempfile and you must assume the provider will unlink this file. Copy the contents to a Tempfile if you need to.

# File lib/chef/file_content_management/content_base.rb, line 53
def file_for_provider
  raise "class must implement file_for_provider!"
end