Sha256: 32a4db733233e182f6adddfbcb905d7d164ca1cf72b53abba841303df04ae098
Contents?: true
Size: 334 Bytes
Versions: 11
Compression:
Stored size: 334 Bytes
Contents
module LinkThumbnailer module Graders class LinkDensity < ::LinkThumbnailer::Graders::Base def call return 0.0 if text.length == 0 1.0 - (links.count.to_f / text.length.to_f) end private def links node.css('a').map(&:text).compact.reject(&:empty?) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems