Class: Puppet::FileBucket::File::FileContents Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/file_bucket/file.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FileContents

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FileContents.



109
110
111
# File 'lib/puppet/file_bucket/file.rb', line 109

def initialize(path)
  @path = path
end

Instance Method Details

#checksum_data(base_method) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



121
122
123
124
# File 'lib/puppet/file_bucket/file.rb', line 121

def checksum_data(base_method)
  Puppet.info(_("Computing checksum on file %{path}") % { path: @path })
  Puppet::Util::Checksums.method(:"#{base_method}_file").call(@path)
end

#sizeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



117
118
119
# File 'lib/puppet/file_bucket/file.rb', line 117

def size
  Puppet::FileSystem.size(@path)
end

#stream(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



113
114
115
# File 'lib/puppet/file_bucket/file.rb', line 113

def stream(&block)
  Puppet::FileSystem.open(@path, nil, 'rb', &block)
end

#to_binaryObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



126
127
128
# File 'lib/puppet/file_bucket/file.rb', line 126

def to_binary
  Puppet::FileSystem::binread(@path)
end