Class: ComicBook::CB::Archiver

Inherits:
Object
  • Object
show all
Defined in:
lib/comic_book/cb/archiver.rb

Instance Method Summary collapse

Constructor Details

#initialize(source_path) ⇒ Archiver

Returns a new instance of Archiver.



4
5
6
# File 'lib/comic_book/cb/archiver.rb', line 4

def initialize source_path
  @source_path = File.expand_path source_path
end

Instance Method Details

#archive(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/comic_book/cb/archiver.rb', line 8

def archive options = {}
  output_path = options[:to] || determine_output_path

  validate_destination! output_path

  if File.directory? source_path
    archive_folder output_path
  else
    archive_file output_path
  end

  output_path
end