Class: CzjCrawler

Inherits:
Object
  • Object
show all
Defined in:
lib/czj_crawler.rb

Instance Method Summary collapse

Constructor Details

#initializeCzjCrawler

Returns a new instance of CzjCrawler.



6
7
8
9
10
11
# File 'lib/czj_crawler.rb', line 6

def initialize
	@argument_parser = CommandLineArgumentParser.new
	@argument_parser.parse_arguments
	@spider = Spider.new
	@url_store = UrlStore.new(@argument_parser.url_file)
end

Instance Method Details

#crawlObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/czj_crawler.rb', line 13

def crawl
	if @argument_parser.crawl_type == CommandLineArgumentParser::WEB_CRAWLER
		@spider.crawl_web(
			@url_store.get_urls,
			@argument_parser.crawl_depth,
			@argument_parser.page_limit
		)
	else
		@spider.crawl_domain(
			@url_store.get_url,
			@argument_parser.page_limit
		)
	end
end