Sha256: 523207329ae976be0d38af8c63d62b8a771887d64008ebb2bf57036e4d894ce5

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

class Mangos::Processor
  def initialize(package)
    @package = package
    @original_mtime = @package.data_path.exist? ? @package.data_path.mtime : 0
  end

  def create(path)
    Mangos::Book.new.tap { |book| Mangos::BookUpdater.new(@package, book, path).update }
  end

  def update(path, book)
    return false if !update?(path, book)
    Mangos::BookUpdater.new(@package, book, path).update
    true
  end

  def update?(path, book)
    return true if @package.force?
    return true if path.mtime >= @original_mtime
    return true if book.pages == 0
    false
  end

  def delete(book)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mangos-0.5 lib/mangos/processor.rb
mangos-0.4 lib/mangos/processor.rb