Sha256: 0c9e2f41db5426222d0447ce684def31c1f97ebcef332bf334dd37e796beda17

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

require File.join("page_rankr", "ranks", "alexa")
require File.join("page_rankr", "ranks", "google")

module PageRankr
  class Ranks
    attr_reader :rank_trackers
    
    def initialize
      @rank_trackers = self.class.constants
    end
    
    def lookup(site, *trackers)
      trackers = rank_trackers if trackers.empty?
      
      ranks = {}
      trackers.each do |tracker|
        name, klass = tracker.to_s.capitalize, self.class
        
        next unless klass.const_defined? name
        
        ranks[tracker.to_s.downcase.to_sym] = klass.const_get(name).new(site).rank
      end
      ranks
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
PageRankr-1.3.0 lib/page_rankr/ranks.rb