Class: AudioBookCreator::BookCreator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spider, editor, speaker, binder) ⇒ BookCreator

Returns a new instance of BookCreator.



15
16
17
18
19
20
# File 'lib/audio_book_creator/book_creator.rb', line 15

def initialize(spider, editor, speaker, binder)
  @spider  = spider
  @editor  = editor
  @speaker = speaker
  @binder  = binder
end

Instance Attribute Details

#binderObject

spoken_chapter[], book_def -> book force, channels, max_hours, bit_rate, sample_rate



13
14
15
# File 'lib/audio_book_creator/book_creator.rb', line 13

def binder
  @binder
end

#editorObject

page_def || pages -> chapters



8
9
10
# File 'lib/audio_book_creator/book_creator.rb', line 8

def editor
  @editor
end

#speakerObject

spoken_def, base_dir || chapter[] -> spoken_chapters[]



10
11
12
# File 'lib/audio_book_creator/book_creator.rb', line 10

def speaker
  @speaker
end

#spiderObject

config: web (factory), page_def.link_path || outstanding[] -> pages[]

decision (!invalid, !outstanding, !visited)


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

def spider
  @spider
end

Instance Method Details

#create(outstanding) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/audio_book_creator/book_creator.rb', line 22

def create(outstanding)
  speaker.make_directory_structure
  binder.create(
    editor.parse(
      spider.run(outstanding)
    ).map { |chapter| speaker.say(chapter) }
  )
end