Class: Chef::FileContentManagement::ContentBase

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/file_content_management/content_base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(new_resource, current_resource, run_context, logger = Chef::Log.with_child) ⇒ ContentBase

Returns a new instance of ContentBase.



28
29
30
31
32
33
34
# 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

Instance Attribute Details

#current_resourceObject (readonly)

Returns the value of attribute current_resource.



25
26
27
# File 'lib/chef/file_content_management/content_base.rb', line 25

def current_resource
  @current_resource
end

#loggerObject (readonly)

Returns the value of attribute logger.



26
27
28
# File 'lib/chef/file_content_management/content_base.rb', line 26

def logger
  @logger
end

#new_resourceObject (readonly)

Returns the value of attribute new_resource.



24
25
26
# File 'lib/chef/file_content_management/content_base.rb', line 24

def new_resource
  @new_resource
end

#run_contextObject (readonly)

Returns the value of attribute run_context.



23
24
25
# File 'lib/chef/file_content_management/content_base.rb', line 23

def run_context
  @run_context
end

Instance Method Details

#tempfileObject



36
37
38
39
40
41
42
43
44
# 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