Sha256: d3ed7723da0c20fcc84b36df47425db5d64c64057c0398c435eb8a3ed2e5b68f

Contents?: true

Size: 411 Bytes

Versions: 3

Compression:

Stored size: 411 Bytes

Contents

require 'nokogiri'
require 'open-uri'

module PageRankr
  class Backlinks < Tracker
    class Backlink
      attr_reader :backlinks
      alias_method :tracked, :backlinks
      
      def initialize(site)
        @backlinks = clean Nokogiri::HTML(open url(site)).at(xpath).to_s
      end
      
      def clean(backlink_count)
        backlink_count.gsub(/[a-zA-Z,\s\(\)]/, '').to_i
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
PageRankr-1.4.3 lib/page_rankr/backlinks/backlink.rb
PageRankr-1.4.2 lib/page_rankr/backlinks/backlink.rb
PageRankr-1.4.0 lib/page_rankr/backlinks/backlink.rb