Class: AudioBookCreator::WebPage
- Inherits:
-
Object
- Object
- AudioBookCreator::WebPage
- Defined in:
- lib/audio_book_creator/web_page.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#css(path) ⇒ Object
def single_css(path) ; css(path).first ; end.
-
#initialize(url, body) ⇒ WebPage
constructor
attr_accessor :etag.
- #links(path) ⇒ Object
Constructor Details
#initialize(url, body) ⇒ WebPage
attr_accessor :etag
10 11 12 13 |
# File 'lib/audio_book_creator/web_page.rb', line 10 def initialize(url, body) @url = url @body = body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/audio_book_creator/web_page.rb', line 7 def body @body end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/audio_book_creator/web_page.rb', line 6 def url @url end |
Class Method Details
.map_urls(url) ⇒ Object
35 36 37 |
# File 'lib/audio_book_creator/web_page.rb', line 35 def self.map_urls(url) url.map { |o| uri(o) } end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
29 30 31 32 |
# File 'lib/audio_book_creator/web_page.rb', line 29 def ==(other) other.kind_of?(WebPage) && other.url.eql?(url) end |
#css(path) ⇒ Object
def single_css(path) ; css(path).first ; end
16 17 18 |
# File 'lib/audio_book_creator/web_page.rb', line 16 def css(path) dom.css(path).map {|n| n.text } end |
#links(path) ⇒ Object
20 21 22 |
# File 'lib/audio_book_creator/web_page.rb', line 20 def links(path) dom.css(path).map { |a| self.class.uri(url, a["href"]) } end |