Class: EPUB::OCF::PhysicalContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/epub/maker/ocf/physical_container.rb,
lib/epub/maker/ocf/physical_container/zipruby.rb,
lib/epub/maker/ocf/physical_container/archive_zip.rb

Direct Known Subclasses

ArchiveZip, Zipruby

Defined Under Namespace

Classes: ArchiveZip, Zipruby

Constant Summary collapse

@@mtime =
nil

Class Method Summary collapse

Class Method Details

.mtimeObject



18
19
20
# File 'lib/epub/maker/ocf/physical_container.rb', line 18

def mtime
  @@mtime
end

.mtime=(time) ⇒ Time

Sets mtime, which is used when setting mtime of file in EPUB(ZIP) archive. Currently supported for only ArchiveZip adapter

Examples:

EPUB::OCF::PhysicalCotainer.adapter = :ArchiveZip
EPUB::OCF::PhysicalCotainer.mtime = Time.new(2020, 1, 1)


31
32
33
# File 'lib/epub/maker/ocf/physical_container.rb', line 31

def mtime=(time)
  @@mtime = time
end

.save(container_path, path_name, content) ⇒ Object



41
42
43
44
# File 'lib/epub/maker/ocf/physical_container.rb', line 41

def save(container_path, path_name, content)
  warn "EPUB::OCF::PhysicalContainer.#{__method__} is deprecated. Use .write instead"
  write(container_path, path_name, content, mtime: mtime)
end

.write(container_path, path_name, content) ⇒ Object



35
36
37
38
39
# File 'lib/epub/maker/ocf/physical_container.rb', line 35

def write(container_path, path_name, content)
  open(container_path) {|container|
    container.write(path_name, content, mtime: mtime)
  }
end