Sha256: 81ff386d46193ff3ba5113b09d7259b177ddafb6171240ebf7542ed8e05bc87e

Contents?: true

Size: 464 Bytes

Versions: 7

Compression:

Stored size: 464 Bytes

Contents

module LinkThumbnailer
    class Opengraph

      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

    end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
link_thumbnailer-1.1.1 lib/link_thumbnailer/opengraph.rb
link_thumbnailer-1.1.0 lib/link_thumbnailer/opengraph.rb
rcarvalho-link_thumbnailer-1.0.9.1 lib/link_thumbnailer/opengraph.rb
link_thumbnailer-1.0.9 lib/link_thumbnailer/opengraph.rb
link_thumbnailer-1.0.8 lib/link_thumbnailer/opengraph.rb
link_thumbnailer-1.0.7 lib/link_thumbnailer/opengraph.rb
link_thumbnailer-1.0.6 lib/link_thumbnailer/opengraph.rb