module Tjcrawler
Constants
- VERSION
Public Instance Methods
set_db(config)
click to toggle source
# File lib/tjcrawler.rb, line 30 def set_db config ActiveRecord::Base.establish_connection config.db_setting end
start_crawler() { |config| ... }
click to toggle source
# File lib/tjcrawler.rb, line 8 def start_crawler config = Config.new yield config set_db(config) threads = [] config.threads.times.each do threads << Thread.new{ Tjcrawler::Crawler.new(config.css_selector).start } end threads.each(&:join) end
start_parser() { |config| ... }
click to toggle source
# File lib/tjcrawler.rb, line 19 def start_parser config = Config.new yield config set_db(config) threads = [] config.threads.times.each do threads << Thread.new{ Tjcrawler::Parser.new(&config.proc).start } end threads.each(&:join) end