Class: LinkOracle::Extractor::Base
- Inherits:
-
Object
- Object
- LinkOracle::Extractor::Base
- Defined in:
- lib/link_oracle/extractor/base.rb
Instance Attribute Summary collapse
-
#link_data ⇒ Object
readonly
Returns the value of attribute link_data.
-
#parsed_body ⇒ Object
readonly
Returns the value of attribute parsed_body.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #get_content(selector) ⇒ Object
-
#initialize(parsed_url) ⇒ Base
constructor
A new instance of Base.
- #perform ⇒ Object
- #type ⇒ Object
Constructor Details
Instance Attribute Details
#link_data ⇒ Object (readonly)
Returns the value of attribute link_data.
4 5 6 |
# File 'lib/link_oracle/extractor/base.rb', line 4 def link_data @link_data end |
#parsed_body ⇒ Object (readonly)
Returns the value of attribute parsed_body.
4 5 6 |
# File 'lib/link_oracle/extractor/base.rb', line 4 def parsed_body @parsed_body end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/link_oracle/extractor/base.rb', line 4 def url @url end |
Instance Method Details
#get_content(selector) ⇒ Object
24 25 26 27 |
# File 'lib/link_oracle/extractor/base.rb', line 24 def get_content(selector) found = parsed_body.xpath(selector).first (found && !found[:content].empty?) ? [found[:content]] : [] end |
#perform ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/link_oracle/extractor/base.rb', line 16 def perform link_data.assign({ titles: title, image_urls: image, descriptions: description }) end |
#type ⇒ Object
12 13 14 |
# File 'lib/link_oracle/extractor/base.rb', line 12 def type raise "implement me" end |