lib/page_rankr/rank.rb in PageRankr-1.7.1 vs lib/page_rankr/rank.rb in PageRankr-2.0.0

- old
+ new

@@ -1,6 +1,20 @@ module PageRankr - class Rank + module Rank attr_reader :rank alias_method :tracked, :rank + + def initialize(site) + @site = site + + request.on_complete do |response| + html = Nokogiri::HTML(response.body) + @rank = clean(html.search(xpath)) + @rank = nil if @rank.zero? + end + end + + def clean(rank) + rank.to_s.to_i + end end end \ No newline at end of file