module Spidr::Actions

The {Actions} module adds methods to {Agent} for controlling the spidering of links.

Public Instance Methods

continue!(&block) click to toggle source

Continue spidering.

@yield [page]

If a block is given, it will be passed every page visited.

@yieldparam [Page] page

The page to be visited.
# File lib/spidr/actions/actions.rb, line 20
def continue!(&block)
  @paused = false
  return run(&block)
end
pause!() click to toggle source

Pauses the agent, causing spidering to temporarily stop.

@raise [Paused]

Indicates to the agent, that it should pause spidering.
# File lib/spidr/actions/actions.rb, line 41
def pause!
  @paused = true
  raise(Paused)
end
pause=(state) click to toggle source

Sets the pause state of the agent.

@param [Boolean] state

The new pause state of the agent.
# File lib/spidr/actions/actions.rb, line 31
def pause=(state)
  @paused = state
end
paused?() click to toggle source

Determines whether the agent is paused.

@return [Boolean]

Specifies whether the agent is paused.
# File lib/spidr/actions/actions.rb, line 52
def paused?
  @paused == true
end
skip_page!() click to toggle source

Causes the agent to skip the page being visited.

@raise [SkipPage]

Indicates to the agent, that the current page should be skipped.
# File lib/spidr/actions/actions.rb, line 73
def skip_page!
  raise(SkipPage)
end

Protected Instance Methods

initialize_actions(options={}) click to toggle source
# File lib/spidr/actions/actions.rb, line 79
def initialize_actions(options={})
  @paused = false
end