Sha256: 379118913f1e5fbf7cdb01c850f05262b7dc3acddffb19cff02170751cd343d7

Contents?: true

Size: 567 Bytes

Versions: 4

Compression:

Stored size: 567 Bytes

Contents

require_relative "book_reader"

class BooksParser
  attr_reader :root, :site, :books, :pages

  def initialize(root, site)
    @root = root
    @site = site
    @books = []
    @pages = []
  end

  def root_path
    File.join(site.source, root)
  end

  def parse(params)
    Dir.foreach(root_path) do |book_dir|
      book_path = File.join(root_path, book_dir)
      if File.directory?(book_path) and book_dir.chars.first != "."
        pages = BookReader.new(params, site, book_dir).read
        books << pages[0]
        @pages += pages
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jekyll-books-0.3.1 lib/jekyll-books/books_parser.rb
jekyll-books-0.3.0 lib/jekyll-books/books_parser.rb
jekyll-books-0.2.1 lib/jekyll-books/books_parser.rb
jekyll-books-0.2.0 lib/jekyll-books/books_parser.rb