Sha256: 029ac795d643a16540ce3b9680239ff04121da20848d50fea1088f58ca07b8d3

Contents?: true

Size: 821 Bytes

Versions: 1

Compression:

Stored size: 821 Bytes

Contents

require 'ostruct'
require 'anemone/core'

module Anemone
  # Version number
  VERSION = '0.1.0'
  
  # User-Agent string used for HTTP requests
  USER_AGENT = "Anemone/#{self::VERSION}"
  
  #module-wide options
  def Anemone.options=(options)
    @options = options
  end
  
  def Anemone.options
    @options
  end
  
  #
  # Convenience method to start a crawl using Core
  #
  def Anemone.crawl(urls, options = {}, &block)
    Anemone.options = OpenStruct.new(options)
	
    #by default, run 4 Tentacle threads to fetch pages
    Anemone.options.threads ||= 4
	
    #disable verbose output by default
    Anemone.options.verbose ||= false
	
    #by default, don't throw away the page response body after scanning it for links
    Anemone.options.discard_page_bodies ||= false
	
    Core.crawl(urls, &block)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
anemone-0.1.0 lib/anemone/anemone.rb