Class: BrowserOfBabel::PageContent
- Inherits:
-
Object
- Object
- BrowserOfBabel::PageContent
- Defined in:
- lib/browser_of_babel/page_content.rb
Overview
Proxy class to get page’s content from the actual library.
Instance Method Summary collapse
-
#initialize(page) ⇒ PageContent
constructor
A new instance of PageContent.
-
#text ⇒ String
Get the page’s contents as a blob of text.
-
#title ⇒ String
Get the page’s title (it’s book title + number of the page).
Constructor Details
#initialize(page) ⇒ PageContent
Returns a new instance of PageContent.
10 11 12 |
# File 'lib/browser_of_babel/page_content.rb', line 10 def initialize(page) @page = page end |
Instance Method Details
#text ⇒ String
Get the page’s contents as a blob of text.
22 23 24 |
# File 'lib/browser_of_babel/page_content.rb', line 22 def text @text ||= html.css("pre#textblock").text.delete("\n") end |
#title ⇒ String
Get the page’s title (it’s book title + number of the page).
16 17 18 |
# File 'lib/browser_of_babel/page_content.rb', line 16 def title html.title end |