Module: Bookery::Factories::ChapterFactory

Extended by:
ChapterFactory
Included in:
ChapterFactory
Defined in:
lib/bookery/factories/chapter_factory.rb

Defined Under Namespace

Classes: Chapter

Instance Method Summary collapse

Instance Method Details

#create_chapters(book_dir) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/bookery/factories/chapter_factory.rb', line 6

def create_chapters(book_dir)
  chapters = []

  Dir.entries(book_dir).sort.each do |path|
    next if path =~ /\.\.?\z/
    chapters << Chapter.new(File.join(book_dir, path))
  end

  chapters
end