Class: LinkOracle::Extractor::Meta

Inherits:
Base
  • Object
show all
Defined in:
lib/link_oracle/extractor/meta.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
20
21
22
23
# File 'lib/link_oracle/extractor/meta.rb', line 17

def description
  get_content("//meta[translate(
    @name,
    'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
    'abcdefghijklmnopqrstuvwxyz'
  ) = 'description']")
end

#imageObject



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

def image
  get_content("//meta[contains(@name, 'thumbnail')]")
end

#titleObject



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

def title
  found = parsed_body.at_xpath("//title/text()")
  found ? [found.content] : []
end

#typeObject



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

def type
  :meta
end