Sha256: 4d3ba0c732e0c43ecb29b0fc9c041fa5cacfdf42bcf88e8bc6a48ad207d6a51e
Contents?: true
Size: 1.24 KB
Versions: 8
Compression:
Stored size: 1.24 KB
Contents
require 'link_thumbnailer/scrapers/opengraph/base' module LinkThumbnailer module Scrapers module Opengraph class Image < ::LinkThumbnailer::Scrapers::Opengraph::Base def value model end private def model nodes.map { |n| modelize(n, n.attributes['content'].to_s) } end def modelize(node, text = nil) model_class.new(text, size) end def nodes nodes = meta_xpaths(attribute: attribute) nodes.empty? ? meta_xpaths(attribute: attribute, key: :name) : nodes end def size [width.to_i, height.to_i] if width && height end def width Width.new(document).value end def height Height.new(document).value end class Base < ::LinkThumbnailer::Scrapers::Opengraph::Base def value node.attributes['content'].to_s if node end end class Width < Base private def attribute "og:image:width" end end class Height < Base private def attribute "og:image:height" end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems