Class: Camdict::HTTP::Client
- Inherits:
-
Object
- Object
- Camdict::HTTP::Client
- Defined in:
- lib/camdict/http_client.rb
Overview
HTTP Client class
Class Method Summary collapse
-
.get_html(url, agtstr = AGENT) ⇒ Object
Download a html page from a remote site, and return a Nokogiri::HTML
url
will be escaped by this method, and defaultagtstr
is AGENT.
Instance Method Summary collapse
-
#get_html(url, agtstr = AGENT) ⇒ Object
see
self.get_html
.
Class Method Details
.get_html(url, agtstr = AGENT) ⇒ Object
Download a html page from a remote site, and return a Nokogiri::HTML url
will be escaped by this method, and default agtstr
is AGENT.
15 16 17 |
# File 'lib/camdict/http_client.rb', line 15 def self.get_html(url, agtstr = AGENT) new.get_html(url, agtstr) end |
Instance Method Details
#get_html(url, agtstr = AGENT) ⇒ Object
see self.get_html
20 21 22 23 |
# File 'lib/camdict/http_client.rb', line 20 def get_html(url, agtstr = AGENT) url = URI(url) Nokogiri::HTML(open(url, 'User-Agent' => agtstr)) end |