Class: AudioBookCreator::PageDef

Inherits:
Object
  • Object
show all
Defined in:
lib/audio_book_creator/page_def.rb

Overview

information on the format of the html page that is read

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title_path = "h1", body_path = "p", link_path = "a", chapter_path = nil, invalid_urls = {}) ⇒ PageDef



7
8
9
10
11
12
13
# File 'lib/audio_book_creator/page_def.rb', line 7

def initialize(title_path = "h1", body_path = "p", link_path = "a", chapter_path = nil, invalid_urls = {})
  @title_path = title_path
  @body_path = body_path
  @link_path = link_path
  @chapter_path = chapter_path
  @invalid_urls = invalid_urls
end

Instance Attribute Details

#body_pathObject

Returns the value of attribute body_path.



4
5
6
# File 'lib/audio_book_creator/page_def.rb', line 4

def body_path
  @body_path
end

#chapter_pathObject

Returns the value of attribute chapter_path.



4
5
6
# File 'lib/audio_book_creator/page_def.rb', line 4

def chapter_path
  @chapter_path
end

#invalid_urlsObject

Returns the value of attribute invalid_urls.



5
6
7
# File 'lib/audio_book_creator/page_def.rb', line 5

def invalid_urls
  @invalid_urls
end

Returns the value of attribute link_path.



4
5
6
# File 'lib/audio_book_creator/page_def.rb', line 4

def link_path
  @link_path
end

#title_pathObject

Returns the value of attribute title_path.



4
5
6
# File 'lib/audio_book_creator/page_def.rb', line 4

def title_path
  @title_path
end

Instance Method Details



19
20
21
# File 'lib/audio_book_creator/page_def.rb', line 19

def chapter_links(page)
  page.links(chapter_path).select { |href| !invalid_urls.include?(href) }
end


15
16
17
# File 'lib/audio_book_creator/page_def.rb', line 15

def page_links(page)
  page.links(link_path).select { |href| !invalid_urls.include?(href) }
end