Method: ContentPreview::Parser#process_open_graph

Defined in:
lib/content-preview/parser.rb

#process_open_graph(document) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/content-preview/parser.rb', line 32

def process_open_graph(document)
  unless document.xpath('//meta[starts-with(@property, "og:")]').empty?
    for tag in document.xpath('//meta[starts-with(@property, "og:")]') do
      case tag.first.last
      when 'og:title'
        self.title = tag['content']

      when 'og:description'
        self.description = tag['content']

      when 'og:image'
        self.images << tag['content']

      when 'og:video'
        self.video = tag['content']

      end
    end
  end
end