Class: BrowserOfBabel::PageContent

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(page) ⇒ PageContent

Returns a new instance of PageContent.

Parameters:



10
11
12
# File 'lib/browser_of_babel/page_content.rb', line 10

def initialize(page)
  @page = page
end

Instance Method Details

#textString

Get the page’s contents as a blob of text.

Returns:

  • (String)


22
23
24
# File 'lib/browser_of_babel/page_content.rb', line 22

def text
  @text ||= html.css("pre#textblock").text.delete("\n")
end

#titleString

Get the page’s title (it’s book title + number of the page).

Returns:

  • (String)


16
17
18
# File 'lib/browser_of_babel/page_content.rb', line 16

def title
  html.title
end