Class: Mangos::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/mangos/processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(package) ⇒ Processor

Returns a new instance of Processor.



2
3
4
5
# File 'lib/mangos/processor.rb', line 2

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

Instance Method Details

#create(path) ⇒ Object



7
8
9
# File 'lib/mangos/processor.rb', line 7

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

#delete(book) ⇒ Object



17
18
# File 'lib/mangos/processor.rb', line 17

def delete(book)
end

#update(path, book) ⇒ Object



11
12
13
14
15
# File 'lib/mangos/processor.rb', line 11

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