Sha256: 2bc91335e3e032ea359c8ac0fd72fd8a221332ab160d9b7ff7de790bd1527c14

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

module Readability
  class Document
    # This is basically the "content" method, shortened to just pull the top candidate element.
    def get_best_candidate(remove_unlikely_candidates = :default)
      @remove_unlikely_candidates = false if remove_unlikely_candidates == false

      @html.css("script, style").each { |i| i.remove }

      remove_unlikely_candidates! if @remove_unlikely_candidates
      transform_misused_divs_into_paragraphs!
      candidates = score_paragraphs(options[:min_text_length])
      best_candidate = select_best_candidate(candidates)
      best_candidate[:elem]
    rescue NoMethodError
      nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
link_thumbnail-0.1.0 lib/readability/document/get_best_candidate.rb