Class: AudioBookCreator::PageDef
- Inherits:
-
Object
- Object
- AudioBookCreator::PageDef
- 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
-
#body_path ⇒ Object
Returns the value of attribute body_path.
-
#chapter_path ⇒ Object
Returns the value of attribute chapter_path.
-
#invalid_urls ⇒ Object
Returns the value of attribute invalid_urls.
-
#link_path ⇒ Object
Returns the value of attribute link_path.
-
#title_path ⇒ Object
Returns the value of attribute title_path.
Instance Method Summary collapse
- #chapter_links(page) ⇒ Object
-
#initialize(title_path = "h1", body_path = "p", link_path = "a", chapter_path = nil, invalid_urls = {}) ⇒ PageDef
constructor
A new instance of PageDef.
- #page_links(page) ⇒ Object
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_path ⇒ Object
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_path ⇒ Object
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_urls ⇒ Object
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 |
#link_path ⇒ Object
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_path ⇒ Object
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
#chapter_links(page) ⇒ Object
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 |
#page_links(page) ⇒ Object
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 |