lib/webmaster_tools.rb in webmaster_tools-0.1.2 vs lib/webmaster_tools.rb in webmaster_tools-0.1.3
- old
+ new
@@ -67,11 +67,11 @@
end.each_slice(3).map do |slice|
Hash[head.zip(slice)]
end)]
end
- def suggests(url)
+ def suggest_counts(url)
url = CGI::escape norm_url(url)
page = agent.get(SUGGESTS % url)
page.search(".g-section tr").inject({}) do |hash, n|
if (key = n.search("a").first) && (value = n.search(".pages").first)
@@ -119,12 +119,12 @@
errors = lines.inject({}) do |hash, line|
url, response_code, _, detected, category = *line
detected = "20#{$3}-#{'%02d' % $1.to_i}-#{'%02d' % $2.to_i}" if /(\d{1,2})\/(\d{1,2})\/(\d{2})/ =~ detected
unless category.to_s.empty?
sub_hash = split ? (hash[detected] ||= {}) : hash
- sub_hash[category] ||= 0
- sub_hash[category] += 1
+ sub_hash[to_key(category)] ||= 0
+ sub_hash[to_key(category)] += 1
end
hash
end
Hash[errors.sort { |a,b| a[0] <=> b[0] }]
end
@@ -154,15 +154,7 @@
end
def to_value(value)
value.gsub(/\D/, '').to_i
end
-
- # def security_token2(url)
- # url = CGI::escape norm_url(url)
- # page = agent.get(REMOVAL % [url, url])
- # page.form.fields.select do |field|
- # field.name == "security_token"
- # end.first.value
- # end
end