Class: LinkOracle::Extractor::OG

Inherits:
Base
  • Object
show all
Defined in:
lib/link_oracle/extractor/og.rb

Instance Attribute Summary

Attributes inherited from Base

#link_data, #parsed_body, #url

Instance Method Summary collapse

Methods inherited from Base

#get_content, #initialize, #perform

Constructor Details

This class inherits a constructor from LinkOracle::Extractor::Base

Instance Method Details

#descriptionObject



17
18
19
# File 'lib/link_oracle/extractor/og.rb', line 17

def description
  get_content("//meta[@property='og:description']")
end

#imageObject



12
13
14
15
# File 'lib/link_oracle/extractor/og.rb', line 12

def image
  return image_data if !image_data.first
  image_is_path? ? [] : image_data
end

#image_dataObject



25
26
27
# File 'lib/link_oracle/extractor/og.rb', line 25

def image_data
  get_content("//meta[@property='og:image']")
end

#image_is_path?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/link_oracle/extractor/og.rb', line 21

def image_is_path?
  !!(image_data.first.match(/\A\//))
end

#titleObject



8
9
10
# File 'lib/link_oracle/extractor/og.rb', line 8

def title
  get_content("//meta[@property='og:title']")
end

#typeObject



4
5
6
# File 'lib/link_oracle/extractor/og.rb', line 4

def type
  :og
end