Sha256: 0ce1e68ab9e96278a2633288fb7268117214d02bebdb9dc4ffaaefac4a435cbc
Contents?: true
Size: 915 Bytes
Versions: 10
Compression:
Stored size: 915 Bytes
Contents
# Aruba module Aruba # Platforms module Platforms # Create files with fixed size # # This class is not meant to be used directly by users. # # It uses a single null byte as content and really creates so called sparse # files. # # @private class ArubaFixedSizeFileCreator # Write File # # @param [String] path # The path to write content to # # @param [Numeric] size # The size of the file # # @param [Boolean] check_presence (false) # Check if file exist def call(path, size, check_presence) if check_presence && !Aruba.platform.file?(path) raise "Expected #{path} to be present" end Aruba.platform.mkdir(File.dirname(path)) File.open(path, "wb") do |f| f.seek(size - 1) f.write("\0") end self end end end end
Version data entries
10 entries across 10 versions & 3 rubygems