Class: ChambaSearchMx::HTMLPage
- Inherits:
-
Object
- Object
- ChambaSearchMx::HTMLPage
- Defined in:
- lib/chamba_search_mx/html_page.rb
Overview
loads web page using nokogiri
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ HTMLPage
constructor
A new instance of HTMLPage.
-
#load(url) ⇒ Object
loads Kokogiri::HTML:Document as @content which can be read.
Constructor Details
#initialize(opts = {}) ⇒ HTMLPage
Returns a new instance of HTMLPage.
12 13 14 |
# File 'lib/chamba_search_mx/html_page.rb', line 12 def initialize(opts = {}) @base_url = opts[:base_url] || ChambaSearchMx::BASE_URL end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
8 9 10 |
# File 'lib/chamba_search_mx/html_page.rb', line 8 def content @content end |
Instance Method Details
#load(url) ⇒ Object
loads Kokogiri::HTML:Document as @content which can be read
19 20 21 |
# File 'lib/chamba_search_mx/html_page.rb', line 19 def load(url) @content = Nokogiri::HTML open("#{@base_url}#{url}") end |