Class: FakkuChapter

Inherits:
ChapterCrawler show all
Defined in:
lib/yamd/fakku.rb

Instance Attribute Summary

Attributes inherited from ChapterCrawler

#custom_data, #manga, #number, #parsed_html, #uri, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ChapterCrawler

#initialize, #pages

Constructor Details

This class inherits a constructor from ChapterCrawler

Class Method Details

.page_classObject



11
12
13
# File 'lib/yamd/fakku.rb', line 11

def self.page_class
  FakkuPage
end

Instance Method Details

#nameObject



27
28
29
# File 'lib/yamd/fakku.rb', line 27

def name
  @custom_data[:name]
end

#pages_infoObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/yamd/fakku.rb', line 15

def pages_info
  # there's no need of an lazy enumerator here, no IO action is taken
  page_options = @parsed_html.at_css('div#content select.drop').css('option')
  pages_number = page_options.map { | option | option['value'].to_i }.max
  
  page_urls = (1..pages_number).to_a.map do | i |
    { url: self.url + "#page=#{i}" }
  end

  page_urls
end