Class: LinkOracle::LinkData
- Inherits:
-
Object
- Object
- LinkOracle::LinkData
- Defined in:
- lib/link_oracle/link_data.rb,
lib/link_oracle/link_data/data.rb
Defined Under Namespace
Classes: Data
Instance Attribute Summary collapse
-
#parsed_url ⇒ Object
readonly
Returns the value of attribute parsed_url.
Instance Method Summary collapse
- #body ⇒ Object
- #description ⇒ Object
- #image_url ⇒ Object
-
#initialize(parsed_url) ⇒ LinkData
constructor
A new instance of LinkData.
- #meta ⇒ Object
- #og ⇒ Object
-
#title ⇒ Object
TODO: Need to write tests for these.
Constructor Details
#initialize(parsed_url) ⇒ LinkData
Returns a new instance of LinkData.
5 6 7 |
# File 'lib/link_oracle/link_data.rb', line 5 def initialize(parsed_url) @parsed_url = parsed_url end |
Instance Attribute Details
#parsed_url ⇒ Object (readonly)
Returns the value of attribute parsed_url.
3 4 5 |
# File 'lib/link_oracle/link_data.rb', line 3 def parsed_url @parsed_url end |
Instance Method Details
#body ⇒ Object
32 33 34 |
# File 'lib/link_oracle/link_data.rb', line 32 def body @body ||= Extractor::Body.new(parsed_url).perform end |
#description ⇒ Object
15 16 17 18 |
# File 'lib/link_oracle/link_data.rb', line 15 def description description = og.description || .description || body.description description.strip if description end |
#image_url ⇒ Object
20 21 22 |
# File 'lib/link_oracle/link_data.rb', line 20 def image_url og.image_url || .image_url || body.image_url end |
#meta ⇒ Object
28 29 30 |
# File 'lib/link_oracle/link_data.rb', line 28 def ||= Extractor::Meta.new(parsed_url).perform end |
#og ⇒ Object
24 25 26 |
# File 'lib/link_oracle/link_data.rb', line 24 def og @og ||= Extractor::OG.new(parsed_url).perform end |
#title ⇒ Object
TODO: Need to write tests for these
10 11 12 13 |
# File 'lib/link_oracle/link_data.rb', line 10 def title title = og.title || .title || body.title title.strip if title end |