Class: LinkThumbnailer::Opengraph
- Inherits:
-
Object
- Object
- LinkThumbnailer::Opengraph
- Defined in:
- lib/link_thumbnailer/opengraph.rb
Class Method Summary collapse
Class Method Details
.parse(object, doc) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/link_thumbnailer/opengraph.rb', line 4 def self.parse(object, doc) doc.css('meta').each do |m| if m.attribute('property') && m.attribute('property').to_s.match(/^og:(.+)$/i) object[$1.gsub('-', '_')] = m.attribute('content').to_s end end object[:images] = [] if object[:image] object[:images] << { source_url: object[:image] } end object end |