Module: Spidr::Actions

Defined in:
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

Classes: Action, Paused, SkipLink, SkipPage

Instance Method Summary

Instance Method Details

- (Object) continue!(&block) {|page| ... }

Continue spidering.

Yields:

  • (page) — If a block is given, it will be passed every page visited.

Yield Parameters:

  • (Page) page — The page to be visited.


22
23
24
25
# File 'lib/spidr/actions/actions.rb', line 22

def continue!(&block)
  @paused = false
  return run(&block)
end

- (Actions) initialize(options = {})

A new instance of Actions



7
8
9
10
11
# File 'lib/spidr/actions/actions.rb', line 7

def initialize(options={})
  @paused = false

  super(options)
end

- (Object) pause!

Pauses the agent, causing spidering to temporarily stop.

Raises:

  • (Paused) — Indicates to the agent, that it should pause spidering.


43
44
45
46
# File 'lib/spidr/actions/actions.rb', line 43

def pause!
  @paused = true
  raise(Paused)
end

- (Object) pause=(state)

Sets the pause state of the agent.

Parameters:

  • (Boolean) state — The new pause state of the agent.


33
34
35
# File 'lib/spidr/actions/actions.rb', line 33

def pause=(state)
  @paused = state
end

- (Boolean) paused?

Determines whether the agent is paused.

Returns:

  • (Boolean) — Specifies whether the agent is paused.


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

def paused?
  @paused == true
end

- (Object) skip_link!

Causes the agent to skip the link being enqueued.

Raises:

  • (SkipLink) — Indicates to the agent, that the current link should be skipped, and not enqueued or visited.


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

def skip_link!
  raise(SkipLink)
end

- (Object) skip_page!

Causes the agent to skip the page being visited.

Raises:

  • (SkipPage) — Indicates to the agent, that the current page should be skipped.


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

def skip_page!
  raise(SkipPage)
end