Method: Abrupt::Crawler#initialize

Defined in:
lib/abrupt/crawler.rb

#initialize(uri, *args) ⇒ Crawler

Returns a new instance of Crawler.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/abrupt/crawler.rb', line 28

def initialize(uri, *args)
  @uri = Addressable::URI.parse(uri).normalize
  opts = args.first
  @options = {
      lang: 'en',
      services: %w(r i s c l p),
      depth: '3',
      word_limit: 20
  }
  @options[:services] = opts[:services] if opts[:services]
  @options[:lang] = opts[:lang] if opts[:lang]
  @follow_links = !opts[:nofollow]
  @result = {}
end