Class: ComicBook::CB

Inherits:
Adapter show all
Defined in:
lib/comic_book/cb.rb,
lib/comic_book/cb/archiver.rb,
lib/comic_book/cb/extractor.rb

Defined Under Namespace

Classes: Archiver, Extractor

Instance Method Summary collapse

Methods inherited from Adapter

#images, #images_and_info, #initialize, #pages

Constructor Details

This class inherits a constructor from ComicBook::Adapter

Instance Method Details

#archive(options = {}) ⇒ Object



8
9
10
# File 'lib/comic_book/cb.rb', line 8

def archive options = {}
  Archiver.new(path).archive options
end

#entriesObject

Every file in the folder, as Entries with folder-relative paths



17
18
19
20
21
22
# File 'lib/comic_book/cb.rb', line 17

def entries
  Dir.glob(File.join(path, '**', '*')).reject { File.directory? it }.map do |file|
    relative = Pathname.new(file).relative_path_from(Pathname.new(path)).to_s
    ComicBook::Entry.new relative
  end
end

#extract(_options = {}) ⇒ Object



12
13
14
# File 'lib/comic_book/cb.rb', line 12

def extract _options = {}
  Extractor.new(path).extract
end

#infoObject



24
25
26
27
28
29
# File 'lib/comic_book/cb.rb', line 24

def info
  xml_path = File.join path, 'ComicInfo.xml'
  return nil unless File.exist? xml_path

  ComicInfo.load xml_path
end