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) ⇒ ContentBase

Returns a new instance of ContentBase


27
28
29
30
31
32
# File 'lib/chef/file_content_management/content_base.rb', line 27

def initialize(new_resource, current_resource, run_context)
  @new_resource = new_resource
  @current_resource = current_resource
  @run_context = run_context
  @tempfile_loaded = false
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

#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


34
35
36
37
38
39
40
41
42
# File 'lib/chef/file_content_management/content_base.rb', line 34

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