Class: Aruba::Platforms::ArubaFixedSizeFileCreator
- Inherits:
-
Object
- Object
- Aruba::Platforms::ArubaFixedSizeFileCreator
- Defined in:
- lib/aruba/platforms/aruba_fixed_size_file_creator.rb
Overview
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.
Instance Method Summary collapse
-
#call(path, size, check_presence) ⇒ Object
Write File.
Instance Method Details
#call(path, size, check_presence) ⇒ Object
Write File
24 25 26 27 28 29 30 31 32 |
# File 'lib/aruba/platforms/aruba_fixed_size_file_creator.rb', line 24 def call(path, size, check_presence) fail "Expected #{path} to be present" if check_presence && !Aruba.platform.file?(path) Aruba.platform.mkdir(File.dirname(path)) File.open(path, "wb"){ |f| f.seek(size - 1); f.write("\0") } self end |