Class: AudioBookCreator::Conductor

Inherits:
Object
  • Object
show all
Defined in:
lib/audio_book_creator/conductor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page_def, book_def, speaker_def, surfer_def) ⇒ Conductor

Returns a new instance of Conductor.



8
9
10
11
12
13
14
15
# File 'lib/audio_book_creator/conductor.rb', line 8

def initialize(page_def, book_def, speaker_def, surfer_def)
  @page_def    = page_def
  @book_def    = book_def
  @speaker_def = speaker_def
  @surfer_def  = surfer_def

  page_def.invalid_urls = invalid_urls
end

Instance Attribute Details

#book_defObject

Returns the value of attribute book_def.



4
5
6
# File 'lib/audio_book_creator/conductor.rb', line 4

def book_def
  @book_def
end

#page_defObject

Returns the value of attribute page_def.



3
4
5
# File 'lib/audio_book_creator/conductor.rb', line 3

def page_def
  @page_def
end

#speaker_defObject

Returns the value of attribute speaker_def.



5
6
7
# File 'lib/audio_book_creator/conductor.rb', line 5

def speaker_def
  @speaker_def
end

#surfer_defObject

Returns the value of attribute surfer_def.



6
7
8
# File 'lib/audio_book_creator/conductor.rb', line 6

def surfer_def
  @surfer_def
end

Instance Method Details

#binderObject



51
52
53
# File 'lib/audio_book_creator/conductor.rb', line 51

def binder
  @binder ||= Binder.new(book_def, speaker_def)
end

#cached_webObject



29
30
31
# File 'lib/audio_book_creator/conductor.rb', line 29

def cached_web
  @cached_hash ||= CachedHash.new(page_cache, web)
end

#creatorObject



57
58
59
# File 'lib/audio_book_creator/conductor.rb', line 57

def creator
  @creator ||= BookCreator.new(spider, editor, speaker, binder)
end

#editorObject



43
44
45
# File 'lib/audio_book_creator/conductor.rb', line 43

def editor
  @editor ||= Editor.new(page_def)
end

#invalid_urlsObject



33
34
35
# File 'lib/audio_book_creator/conductor.rb', line 33

def invalid_urls
  @invalid_urls ||= UrlFilter.new(book_def.urls.first)
end

#outstandingObject



61
62
63
# File 'lib/audio_book_creator/conductor.rb', line 61

def outstanding
  @outstanding ||= book_def.unique_urls
end

#page_cacheObject

spider



21
22
23
# File 'lib/audio_book_creator/conductor.rb', line 21

def page_cache
  @page_cache ||= PageDb.new("pages.db", "pages", false)
end

#runObject



65
66
67
# File 'lib/audio_book_creator/conductor.rb', line 65

def run
  creator.create(outstanding)
end

#speakerObject



47
48
49
# File 'lib/audio_book_creator/conductor.rb', line 47

def speaker
  @speaker ||= Speaker.new(speaker_def, book_def)
end

#spiderObject



37
38
39
# File 'lib/audio_book_creator/conductor.rb', line 37

def spider
  @spider ||= Spider.new(page_def, cached_web)
end

#webObject



25
26
27
# File 'lib/audio_book_creator/conductor.rb', line 25

def web
  @web ||= Web.new(surfer_def.max)
end