class ReadmeScore::Document

Attributes

filter[RW]
html[RW]
metrics[RW]

Public Class Methods

load(url) click to toggle source
# File lib/readme-score/document.rb, line 11
def self.load(url)
  loader = Loader.new(url)
  loader.load!
  new(loader.html)
end
new(html) click to toggle source
# File lib/readme-score/document.rb, line 17
def initialize(html)
  @html = html
  @noko = Nokogiri::HTML.fragment(@html)
  @metrics = Document::Metrics.new(html_for_analysis)
end

Public Instance Methods

html_for_analysis() click to toggle source

@return [String] HTML string ready for analysis

# File lib/readme-score/document.rb, line 24
def html_for_analysis
  @filter ||= Document::Filter.new(@noko)
  @filter.filtered_html!
end
inspect() click to toggle source
# File lib/readme-score/document.rb, line 33
def inspect
  "#<#{self.class}>"
end
score() click to toggle source
# File lib/readme-score/document.rb, line 29
def score
  @score ||= Score.new(metrics)
end