Class: DisavowTool::WhiteList
Instance Attribute Summary
Attributes included from DomainAndUrl
#domains, #links
Instance Method Summary
collapse
#add_domain, #add_domain_from_url, #add_domain_prefix, #add_url, #clean_line!, #domain_or_url, #finished_import_hook, #is_url?, #remove_domain_prefix, #remove_domain_prefix!, #summary, #total_elements
Methods inherited from List
#add_domain, #add_url, #clean_line!, #comment?, #count, #delete_url, #delete_urls_if_domains, #each, #export, #import, #mass_delete_urls, #new, #restore, #summary, #to_a
Constructor Details
#initialize(import_files = nil) ⇒ WhiteList
Returns a new instance of WhiteList.
6
7
8
9
10
|
# File 'lib/disavow_tool/white_list.rb', line 6
def initialize(import_files=nil)
raise "No whitelist option given" unless OPTIONS.whitelist
import_files = import_files || OPTIONS.whitelist_files
super(import_files)
end
|
Instance Method Details
#add_url_message(url) ⇒ Object
25
26
27
|
# File 'lib/disavow_tool/white_list.rb', line 25
def add_url_message(url)
"+++ Inserting #{is_url?(url).to_s} #{url.on_yellow} into Whitelist"
end
|
#add_urls_with_same_domain_as(url, import_list) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/disavow_tool/white_list.rb', line 12
def add_urls_with_same_domain_as(url, import_list)
domain = URI.parse(URI.escape(url)).host
puts "Adding to whitelist all imported urls with the domain #{domain}"
import_list.each do |link|
add_url(link) if URI.parse(URI.escape(link)).host == domain
end
puts "Attempting to remove URLs with the domain #{domain} from imported links to stop anaylsing"
import_list.delete_urls_if_domains(domain)
end
|
#export_write(file) ⇒ Object
34
35
36
37
38
|
# File 'lib/disavow_tool/white_list.rb', line 34
def export_write(file)
file.puts "# Whitelist"
super(file)
puts "Writing #{total_elements} White links into whitelist".blue if @verbose
end
|
#import_message(url) ⇒ Object
22
23
24
|
# File 'lib/disavow_tool/white_list.rb', line 22
def import_message(url)
"Importing #{is_url?(url).to_s} #{remove_domain_prefix(url)} into Whitelist"
end
|
#mensaje_sumary_before_export ⇒ Object
29
|
# File 'lib/disavow_tool/white_list.rb', line 29
def mensaje_sumary_before_export; "Whitelist before exporting" end
|
#message_sumary_domains_imported ⇒ Object
32
|
# File 'lib/disavow_tool/white_list.rb', line 32
def message_sumary_domains_imported; "Whitelisted Domains:" end
|
#message_sumary_imported ⇒ Object
28
|
# File 'lib/disavow_tool/white_list.rb', line 28
def message_sumary_imported; "Whitelist links imported" end
|
#message_sumary_links_imported ⇒ Object
31
|
# File 'lib/disavow_tool/white_list.rb', line 31
def message_sumary_links_imported; "Whitelisted URLs:" end
|