Module: Waw::Crawler::Options

Included in:
Waw::Crawler
Defined in:
lib/waw/crawler/crawler_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#check_externalsObject

Checks links that lead outside the website?



12
13
14
# File 'lib/waw/crawler/crawler_options.rb', line 12

def check_externals
  @check_externals
end

#crawl_listObject

XPath queries for crawl



9
10
11
# File 'lib/waw/crawler/crawler_options.rb', line 9

def crawl_list
  @crawl_list
end

#listenerObject

Listener to use



15
16
17
# File 'lib/waw/crawler/crawler_options.rb', line 15

def listener
  @listener
end

#ping_listObject

XPath queries for ping



6
7
8
# File 'lib/waw/crawler/crawler_options.rb', line 6

def ping_list
  @ping_list
end

Instance Method Details

#ping_on(query, value = true) ⇒ Object

Set/unset an XPath query to ping



32
33
34
35
36
37
38
# File 'lib/waw/crawler/crawler_options.rb', line 32

def ping_on(query, value = true)
  if value
    ping_list << query
  else
    ping_list.delete(query)
  end
end

#set_default_optionsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/waw/crawler/crawler_options.rb', line 17

def set_default_options
  @ping_list = [
    'link/@href',
    'img/@src',
    'script/@src',
    'a/@href'
  ]
  @crawl_list = [
    'a/@href'
  ]
  @check_externals = false
  @listener = Crawler::Listener.new(STDOUT)
end