Class: Tankobon::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/tankobon/application.rb

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



4
5
6
# File 'lib/tankobon/application.rb', line 4

def initialize
  no_batch
end

Instance Method Details

#batch(name) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/tankobon/application.rb', line 8

def batch(name)
  if name then
    @batch = name
    @archive = batched_class(Archive)
    @directory = batched_class(Directory)
  else
    no_batch
  end
  self
end

#convert(converters = [KindleDXConverter]) ⇒ Object



40
41
42
43
44
45
# File 'lib/tankobon/application.rb', line 40

def convert(converters = [KindleDXConverter])
  staged_elems.each do |sd|
    converters.each {|tx| sd.convert_images(&tx.new)}
  end
  self
end

#sanitize(transforms = [SanitizeTransform, SequenceTransform]) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/tankobon/application.rb', line 31

def sanitize(transforms = [SanitizeTransform, SequenceTransform])
  staged_elems.each do |sd|
    transforms.each {|tx| sd.rename_images(&tx.new)}
    sd.mv_images_to_root
    sd.clean
  end
  self
end

#with(ary) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/tankobon/application.rb', line 23

def with(ary)
  @staged_ary = ary.map do |elem|
    obj = File.archive?(elem) ? @archive : @directory
    obj.new(elem).to_stage
  end
  self
end

#with_base(base, ary) ⇒ Object



19
20
21
# File 'lib/tankobon/application.rb', line 19

def with_base(base, ary)
  with(ary.map{|x| File.join(base, x)})
end