Class: Mangos::ResortPagesProcessor

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

Instance Method Summary collapse

Constructor Details

#initialize(package) ⇒ ResortPagesProcessor

Returns a new instance of ResortPagesProcessor.



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

def initialize(package)
  @package = package
end

Instance Method Details

#create(path) ⇒ Object



6
7
8
# File 'lib/mangos/resort_pages_processor.rb', line 6

def create(path)
  raise "Not for new books!"
end

#delete(book) ⇒ Object



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

def delete(book)
  raise "Not for deleted books!"
end

#update(path, book) ⇒ Object



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

def update(path, book)
  page_paths = Mangos::PagesInflater.new(book.page_paths).inflate
  sorted_page_paths = Naturalsorter::Sorter.sort(page_paths, true)
  book.page_paths = Mangos::PagesDeflater.new(sorted_page_paths).deflate
  true
end