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

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

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FileContents

Returns a new instance of FileContents.



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

def initialize(path)
  @path = path
end

Instance Method Details

#checksum_data(base_method) ⇒ Object



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

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



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

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

#stream(&block) ⇒ Object



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

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

#to_binaryObject



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

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