class Knigodej::BookShelf

Attributes

books[R]

Public Class Methods

new(s, basepath = './') click to toggle source
# File lib/knigodej.rb, line 202
def initialize s, basepath = './'
   log + { s: s }
   @books = []
   s[ 'книги' ].each_pair do |book, value|
      log > { book: book, value: value }
      if value.empty?
         next ; end
      path = s[ 'къбукы' ] =~ /^[\/~]/ && s[ 'къбукы' ] ||
            File.join( basepath, s[ 'къбукы' ] )
      sets = s[ 'наборы' ]
      @books << Book.new( book, value, path, sets ) ; end
   log >> { :@books => @books } ; end

Public Instance Methods

make(dir, specbook = nil) click to toggle source
# File lib/knigodej.rb, line 190
def make dir, specbook = nil
   log + { dir: dir, specbook: specbook }

   books = specbook && @books.select {|b| b.name == specbook } || @books
   if dir.empty?
      dir = './' ; end
   books.each do |book|
      log >> { book: book }
      pdffn = File.join dir, "#{book.name}.pdf"
      djvufn = File.join dir, "#{book.name}.djvu"
      book.make :pdf => pdffn, :djvu => djvufn ; end ; end