Class: UrlExpander::Expanders::Shorl
- Defined in:
- lib/url_expander/expanders/scrape/shorl.rb
Overview
Expand shorl.com URLS Usage: UrlExpander::Client.expand(“shorl.com/nigekohalenu”)
Defined Under Namespace
Classes: Request
Constant Summary collapse
- PATTERN =
%r'(http://shorl\.com(/[\w/]+))'
Instance Attribute Summary collapse
-
#parent_klass ⇒ Object
readonly
Returns the value of attribute parent_klass.
-
#xpath ⇒ Object
readonly
Returns the value of attribute xpath.
Attributes inherited from Scrape
Class Method Summary collapse
-
.scrape_url(html) ⇒ Object
How to scarpe the url from a shorl html document.
Instance Method Summary collapse
-
#initialize(short_url = "", options = {}) ⇒ Shorl
constructor
A new instance of Shorl.
Constructor Details
#initialize(short_url = "", options = {}) ⇒ Shorl
Returns a new instance of Shorl.
12 13 14 15 |
# File 'lib/url_expander/expanders/scrape/shorl.rb', line 12 def initialize(short_url="", ={}) @parent_klass = self.class super(short_url, ) end |
Instance Attribute Details
#parent_klass ⇒ Object (readonly)
Returns the value of attribute parent_klass.
10 11 12 |
# File 'lib/url_expander/expanders/scrape/shorl.rb', line 10 def parent_klass @parent_klass end |
#xpath ⇒ Object (readonly)
Returns the value of attribute xpath.
10 11 12 |
# File 'lib/url_expander/expanders/scrape/shorl.rb', line 10 def xpath @xpath end |
Class Method Details
.scrape_url(html) ⇒ Object
How to scarpe the url from a shorl html document
19 20 21 22 |
# File 'lib/url_expander/expanders/scrape/shorl.rb', line 19 def self.scrape_url(html) doc = Hpricot(html) doc.at('/html/body/div[3]/p/a').attributes["href"] end |