module Bookery::Factories::ChapterFactory

Public Instance Methods

create_chapters(book_dir) click to toggle source
# 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