Class: CPIO::ArchiveWriter
- Inherits:
-
Object
- Object
- CPIO::ArchiveWriter
show all
- Defined in:
- lib/excavate/extractors/cpio/cpio_old_format.rb
Defined Under Namespace
Classes: ArchiveFinalizedError
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ArchiveWriter.
205
206
207
208
|
# File 'lib/excavate/extractors/cpio/cpio_old_format.rb', line 205
def initialize(io)
@io = io
@open = false
end
|
Instance Method Details
#add_file(name, mode = 0444) {|file| ... } ⇒ Object
228
229
230
231
232
233
|
# File 'lib/excavate/extractors/cpio/cpio_old_format.rb', line 228
def add_file(name, mode = 0444)
file = StringIO.new
yield(file)
entry = ArchiveEntry.new_file(:name => name, :mode => mode, :io => file)
@io.write(entry.to_data)
end
|
#mkdir(name, mode = 0555) ⇒ Object
223
224
225
226
|
# File 'lib/excavate/extractors/cpio/cpio_old_format.rb', line 223
def mkdir(name, mode = 0555)
entry = ArchiveEntry.new_directory(:name => name, :mode => mode)
@io.write(entry.to_data)
end
|
#open ⇒ Object
214
215
216
217
218
219
220
221
|
# File 'lib/excavate/extractors/cpio/cpio_old_format.rb', line 214
def open
raise ArchiveFinalizedError, "This archive has already been finalized" if @finalized
@open = true
yield(self)
ensure
close
finalize
end
|
#open? ⇒ Boolean
210
211
212
|
# File 'lib/excavate/extractors/cpio/cpio_old_format.rb', line 210
def open?
@open
end
|