module Makuri::Spider::ClassMethods

Public Instance Methods

run() click to toggle source
# File lib/makuri/spider.rb, line 25
def run
  raise "Start URLs not found. Define start_urls for #{self}." unless defined? @start_urls

  @engine ||= :net_http

  @start_urls.each { |start_url| new(start_url: start_url, engine: @engine).parse }
end
spider_options(**options) click to toggle source
# File lib/makuri/spider.rb, line 21
def spider_options(**options)
  @engine = options.fetch(:engine, :net_http)
end
start_urls(urls) click to toggle source
# File lib/makuri/spider.rb, line 15
def start_urls(urls)
  raise 'Invalid format for start_urls. Pass urls in an array.' unless urls.is_a? Array

  @start_urls = urls
end