Class: EPUB::OCF::PhysicalContainer::Rubyzip

Inherits:
EPUB::OCF::PhysicalContainer show all
Defined in:
lib/epub/maker/ocf/physical_container/rubyzip.rb

Instance Method Summary collapse

Methods inherited from EPUB::OCF::PhysicalContainer

mtime, mtime=, save, write

Instance Method Details

#write(path_name, content, mtime: nil) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/epub/maker/ocf/physical_container/rubyzip.rb', line 7

def write(path_name, content, mtime: nil)
  if @archive
    @archive.remove path_name
    @archive.get_output_stream(path_name, nil, nil, nil, nil, nil, nil, nil, mtime) {|f| f.write content}
    @archive.commit
  else
    open {|container| container.write(path_name, content, mtime: mtime)}
  end
end