Class: WebComics::CBZ
Instance Attribute Summary collapse
Attributes inherited from ComicsDir
#series
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from ComicsDir
comics_entries, #directory?, #file?, #filter_alpha_dirs, #filter_alphanum_dirs, #filter_num_dirs, #list_directories, #list_files, trim
Instance Attribute Details
#cbz ⇒ Object
Returns the value of attribute cbz.
5
6
7
|
# File 'lib/comics_cbz.rb', line 5
def cbz
@cbz
end
|
Class Method Details
.cbz_or_zip?(file) ⇒ Boolean
7
8
9
10
11
12
13
|
# File 'lib/comics_cbz.rb', line 7
def self.cbz_or_zip?(file)
if File.extname(file) == ".cbz" || File.extname(file) == ".zip"
return true
else
return false
end
end
|
.ignore_xml(list) ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'lib/comics_cbz.rb', line 46
def self.ignore_xml(list)
files_list = []
list.each do |entry|
files_list.push(entry) if File.extname(entry) != ".xml"
end
files_list
end
|
Instance Method Details
37
38
39
40
41
42
43
44
|
# File 'lib/comics_cbz.rb', line 37
def (index = 0)
@page = nil
Zip::File.open("#{@series}/#{@cbz}") do |cbz|
@page = cbz.(list_pages_inside[index], list_pages_inside[index])
end
@page
end
|
#list_cbz_files ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/comics_cbz.rb', line 15
def list_cbz_files
files_list = []
list_files.each do |cbz|
files_list.push(cbz) if CBZ.cbz_or_zip?(cbz)
end
files_list
end
|
#list_pages_inside(xml_ignore = true) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/comics_cbz.rb', line 24
def list_pages_inside(xml_ignore = true)
files_list = []
Zip::File.open("#{@series}/#{@cbz}") do |cbz|
cbz.each do |pages|
files_list.push(pages.name)
end
end
return CBZ.ignore_xml(files_list) if xml_ignore
files_list
end
|