Method: Query::Result#rank

Defined in:
lib/query/result.rb

#rank(host) ⇒ Object

on base of ranks



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/query/result.rb', line 17

def rank(host)#on base of ranks
  @rank ||= %w(seo_ranks ads_top ads_right ads_bottom).map do |type_str|
    result = nil
    send(type_str).each_with_index do |line,index|
      if host.class == Regexp
        result = index + 1 and break if line[:host] =~ host
      elsif host.class == String
        result = index + 1 and break if line[:host] == host
      else
        result = false
      end
    end
    result
  end
end