Class: Chef::ChefFS::FileSystem::CookbookFile
Instance Attribute Summary collapse
Attributes inherited from BaseFSObject
#name, #parent, #path
Instance Method Summary
collapse
#can_have_child?, #chef_object, #child, #children, #create_child, #delete, #dir?, #exists?, #path_for_printing, #root, #write
Constructor Details
#initialize(name, parent, file) ⇒ CookbookFile
Returns a new instance of CookbookFile.
27
28
29
30
|
# File 'lib/chef/chef_fs/file_system/cookbook_file.rb', line 27
def initialize(name, parent, file)
super(name, parent)
@file = file
end
|
Instance Attribute Details
Returns the value of attribute file.
32
33
34
|
# File 'lib/chef/chef_fs/file_system/cookbook_file.rb', line 32
def file
@file
end
|
Instance Method Details
34
35
36
|
# File 'lib/chef/chef_fs/file_system/cookbook_file.rb', line 34
def checksum
file[:checksum]
end
|
#compare_to(other) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/chef/chef_fs/file_system/cookbook_file.rb', line 59
def compare_to(other)
other_value = nil
if other.respond_to?(:checksum)
other_checksum = other.checksum
else
begin
other_value = other.read
rescue Chef::ChefFS::FileSystem::NotFoundError
return [ false, nil, :none ]
end
other_checksum = calc_checksum(other_value)
end
[ checksum == other_checksum, nil, other_value ]
end
|
55
56
57
|
# File 'lib/chef/chef_fs/file_system/cookbook_file.rb', line 55
def rest
parent.rest
end
|