Module: Spidr

Defined in:
lib/spidr/page.rb,
lib/spidr/agent.rb,
lib/spidr/spidr.rb,
lib/spidr/rules.rb,
lib/spidr/events.rb,
lib/spidr/filters.rb,
lib/spidr/version.rb,
lib/spidr/sanitizers.rb,
lib/spidr/cookie_jar.rb,
lib/spidr/auth_store.rb,
lib/spidr/session_cache.rb,
lib/spidr/auth_credential.rb,
lib/spidr/actions/actions.rb,
lib/spidr/actions/exceptions/paused.rb,
lib/spidr/actions/exceptions/action.rb,
lib/spidr/actions/exceptions/skip_page.rb,
lib/spidr/actions/exceptions/skip_link.rb

Defined Under Namespace

Modules: Actions, Events, Filters, Sanitizers Classes: Agent, AuthCredential, AuthStore, CookieJar, Page, Rules, SessionCache

Constant Summary

COMMON_PROXY_PORT = Common proxy port.
8080
DEFAULT_PROXY = Default proxy information.
{
  :host => nil,
  :port => COMMON_PROXY_PORT,
  :user => nil,
  :password => nil
}
VERSION = Spidr version.
'0.2.2'

Class Method Summary

Class Method Details

+ (Object) disable_proxy!

Disables the proxy settings used by all newly created Agent objects.



53
54
55
56
# File 'lib/spidr/spidr.rb', line 53

def Spidr.disable_proxy!
  @@spidr_proxy = DEFAULT_PROXY
  return true
end

+ (Object) host(name, options = {}, &block)

See Also:



88
89
90
# File 'lib/spidr/spidr.rb', line 88

def Spidr.host(name,options={},&block)
  Agent.host(name,options,&block)
end

+ (Hash) proxy

Proxy information used by all newly created Agent objects by default.

Returns:

  • (Hash) — The Spidr proxy information.


21
22
23
# File 'lib/spidr/spidr.rb', line 21

def Spidr.proxy
  @@spidr_proxy ||= DEFAULT_PROXY
end

+ (Hash) proxy=(new_proxy)

Sets the proxy information used by Agent objects.

Parameters:

  • (Hash) new_proxy — The new proxy information.

Options Hash (new_proxy):

  • (String) :host N/A — The host-name of the proxy.
  • (Integer) :port — default: COMMON_PROXY_PORT — The port of the proxy.
  • (String) :user N/A — The user to authenticate with the proxy as.
  • (String) :password N/A — The password to authenticate with the proxy.

Returns:

  • (Hash) — The new proxy information.


46
47
48
# File 'lib/spidr/spidr.rb', line 46

def Spidr.proxy=(new_proxy)
  @@spidr_proxy = {:port => COMMON_PROXY_PORT}.merge(new_proxy)
end

+ (Object) site(url, options = {}, &block)

See Also:



95
96
97
# File 'lib/spidr/spidr.rb', line 95

def Spidr.site(url,options={},&block)
  Agent.site(url,options,&block)
end

+ (Object) start_at(url, options = {}, &block)

See Also:



81
82
83
# File 'lib/spidr/spidr.rb', line 81

def Spidr.start_at(url,options={},&block)
  Agent.start_at(url,options,&block)
end

+ (String) user_agent

The User-Agent string used by all Agent objects by default.

Returns:

  • (String) — The Spidr User-Agent string.


64
65
66
# File 'lib/spidr/spidr.rb', line 64

def Spidr.user_agent
  @@spidr_user_agent ||= nil
end

+ (Object) user_agent=(new_agent)

Sets the Spidr User-Agent string.

Parameters:

  • (String) new_agent — The new User-Agent string.


74
75
76
# File 'lib/spidr/spidr.rb', line 74

def Spidr.user_agent=(new_agent)
  @@spidr_user_agent = new_agent
end