Class: ComicBook::CB7
- Inherits:
-
Adapter
show all
- Defined in:
- lib/comic_book/cb7.rb,
lib/comic_book/cb7/archiver.rb,
lib/comic_book/cb7/extractor.rb
Defined Under Namespace
Classes: Archiver, Extractor
Instance Method Summary
collapse
Methods inherited from Adapter
#initialize
Instance Method Details
#archive(options = {}) ⇒ Object
9
10
11
|
# File 'lib/comic_book/cb7.rb', line 9
def archive options = {}
Archiver.new(path).archive options
end
|
13
14
15
|
# File 'lib/comic_book/cb7.rb', line 13
def options = {}
Extractor.new(path). options
end
|
#info ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/comic_book/cb7.rb', line 17
def info
xml = nil
File.open(path, 'rb') do |file|
SevenZipRuby::Reader.open(file) do |reader|
entry = reader.entries.find { it.path == 'ComicInfo.xml' }
xml = reader.(entry.index) if entry
end
end
return nil unless xml
ComicInfo.load xml
end
|
#pages ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/comic_book/cb7.rb', line 32
def pages
entries = []
File.open(path, 'rb') do |file|
SevenZipRuby::Reader.open(file) do |reader|
reader.entries.each do |entry|
entries << entry.path if entry.file?
end
end
end
entries.select { image_file? it }
.map { create_page_from_entry it }
.sort_by(&:name)
end
|