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.



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

def initialize(path)
  @path = path
end

Instance Method Details

#checksum_data(base_method) ⇒ Object



135
136
137
138
# File 'lib/puppet/file_bucket/file.rb', line 135

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

#sizeObject



131
132
133
# File 'lib/puppet/file_bucket/file.rb', line 131

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

#stream(&block) ⇒ Object



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

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

#to_binaryObject



140
141
142
# File 'lib/puppet/file_bucket/file.rb', line 140

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