Module: Spidr::Actions
- Included in:
- Agent
- Defined in:
- lib/spidr/actions/actions.rb,
lib/spidr/actions/exceptions/action.rb,
lib/spidr/actions/exceptions/paused.rb,
lib/spidr/actions/exceptions/skip_link.rb,
lib/spidr/actions/exceptions/skip_page.rb
Overview
Defined Under Namespace
Classes: Action, Paused, SkipLink, SkipPage
Instance Method Summary collapse
-
#continue! {|page| ... } ⇒ Object
Continue spidering.
- #initialize_actions(options = {}) ⇒ Object protected
-
#pause! ⇒ Object
Pauses the agent, causing spidering to temporarily stop.
-
#pause=(state) ⇒ Object
Sets the pause state of the agent.
-
#paused? ⇒ Boolean
Determines whether the agent is paused.
-
#skip_link! ⇒ Object
Causes the agent to skip the link being enqueued.
-
#skip_page! ⇒ Object
Causes the agent to skip the page being visited.
Instance Method Details
#continue! {|page| ... } ⇒ Object
Continue spidering.
20 21 22 23 |
# File 'lib/spidr/actions/actions.rb', line 20 def continue!(&block) @paused = false return run(&block) end |
#initialize_actions(options = {}) ⇒ Object (protected)
79 80 81 |
# File 'lib/spidr/actions/actions.rb', line 79 def initialize_actions(={}) @paused = false end |
#pause! ⇒ Object
Pauses the agent, causing spidering to temporarily stop.
41 42 43 44 |
# File 'lib/spidr/actions/actions.rb', line 41 def pause! @paused = true raise(Paused) end |
#pause=(state) ⇒ Object
Sets the pause state of the agent.
31 32 33 |
# File 'lib/spidr/actions/actions.rb', line 31 def pause=(state) @paused = state end |
#paused? ⇒ Boolean
Determines whether the agent is paused.
52 53 54 |
# File 'lib/spidr/actions/actions.rb', line 52 def paused? @paused == true end |
#skip_link! ⇒ Object
Causes the agent to skip the link being enqueued.
63 64 65 |
# File 'lib/spidr/actions/actions.rb', line 63 def skip_link! raise(SkipLink) end |
#skip_page! ⇒ Object
Causes the agent to skip the page being visited.
73 74 75 |
# File 'lib/spidr/actions/actions.rb', line 73 def skip_page! raise(SkipPage) end |