Class: WebComics::ComicsEngine
- Inherits:
-
CBZ
show all
- Defined in:
- lib/comics_engine.rb
Constant Summary
collapse
- FILE_EXT_ARRY =
[".jpg", ".png", ".tiff", ".bmp", ".gif"]
Instance Attribute Summary
Attributes inherited from CBZ
#cbz
Attributes inherited from ComicsDir
#series
Instance Method Summary
collapse
Methods inherited from CBZ
cbz_or_zip?, #extract, ignore_xml, #list_cbz_files, #list_pages_inside
Methods inherited from ComicsDir
comics_entries, #directory?, #file?, #filter_alpha_dirs, #filter_alphanum_dirs, #filter_num_dirs, #list_directories, #list_files, trim
Instance Method Details
#assets_dirs ⇒ Object
13
14
15
|
# File 'lib/comics_engine.rb', line 13
def assets_dirs
filter(ComicsDir.comics_entries(@series))
end
|
#filter(entries) ⇒ Object
7
8
9
10
11
|
# File 'lib/comics_engine.rb', line 7
def filter(entries)
entries.each_index do |i|
entries.delete_if { |e| e.include?(FILE_EXT_ARRY[i]) || e.include?("#") }
end
end
|
#list_pages ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/comics_engine.rb', line 21
def list_pages
if CBZ.cbz_or_zip?("#{@series}/#{@cbz}")
list_pages_cbz
else
img_list = []
FileUtils.cd(@series) do
ComicsDir.comics_entries(".").each do |e|
img_list.push(e) if File.extname(e) == ".jpg" || File.extname(e) == ".png"
end
end
img_list.sort
end
end
|
#list_pages_cbz ⇒ Object
17
18
19
|
# File 'lib/comics_engine.rb', line 17
def list_pages_cbz
list_pages_inside.sort
end
|