lib/link_thumbnailer/scrapers/default/description.rb in link_thumbnailer-2.6.1 vs lib/link_thumbnailer/scrapers/default/description.rb in link_thumbnailer-3.0.0
- old
+ new
@@ -16,11 +16,11 @@
def model_from_meta
modelize(node_from_meta, node_from_meta.attributes['content'].value) if node_from_meta
end
def model_from_body
- nodes_from_body.each_with_index.map { |node, i| modelize(node, node.text, i + 1) }.sort.last
+ nodes_from_body.each_with_index.map { |node, i| modelize(node, node.text, i) }.sort.last
end
def node_from_meta
@node_from_meta ||= meta_xpath(key: :name)
end
@@ -35,11 +35,11 @@
def candidates
document.css('p,td')
end
- def modelize(node, text, i = 1)
- model_class.new(node, text, i)
+ def modelize(node, text, i = 0)
+ model_class.new(node, text, i, nodes_from_body.count)
end
end
end
end