<commit_before>require 'spidr/actions/exceptions/paused'
require 'spidr/actions/exceptions/skip_link'
require 'spidr/actions/exceptions/skip_page'

module Spidr
  module Actions
    def initialize(options={})
      @paused = false

      super(options)
    end

    #
    # Continue spidering. If a _block_ is given, it will be passed every
    # page visited.
    #
    def continue!(&block)
      @paused = false
      return run(&block)
    end

    #
    # Sets the pause state of the agent.
    #
    def pause=(state)
      @paused = state
    end

    #
    # Pauses the agent, causing spidering to temporarily stop.
    #
    def pause!
      @paused = true
      raise(Paused)
    end

    #
    # Returns +true+ if the agent is paused, returns +false+ otherwise.
    #
    def paused?
      @paused == true
    end

    #
    # Causes the agent to skip the link being enqueued.
    #
    def skip_link!
      raise(SkipLink)
    end

    #
    # Causes the agent to skip the page being visited.
    #
    def skip_page!
      raise(SkipPage)
    end
  end
end
<commit_msg>Added YARD tags to Spidr::Actions.<commit_after>require 'spidr/actions/exceptions/paused'
require 'spidr/actions/exceptions/skip_link'
require 'spidr/actions/exceptions/skip_page'

module Spidr
  module Actions
    def initialize(options={})
      @paused = false

      super(options)
    end

    #
    # Continue spidering.
    #
    # @yield [page]
    #   If a block is given, it will be passed every page visited.
    #
    # @yieldparam [Page] page
    #   The page to be visited.
    #
    def continue!(&block)
      @paused = false
      return run(&block)
    end

    #
    # Sets the pause state of the agent.
    #
    # @param [Boolean] state
    #   The new pause state of the agent.
    #
    def pause=(state)
      @paused = state
    end

    #
    # Pauses the agent, causing spidering to temporarily stop.
    #
    # @raises [Paused]
    #   Indicates to the agent, that it should pause spidering.
    #
    def pause!
      @paused = true
      raise(Paused)
    end

    #
    # Determines whether the agent is paused.
    #
    # @return [Boolean]
    #   Specifies whether the agent is paused.
    #
    def paused?
      @paused == true
    end

    #
    # Causes the agent to skip the link being enqueued.
    #
    # @raise [SkipLink]
    #   Indicates to the agent, that the current link should be skipped,
    #   and not enqueued or visited.
    #
    def skip_link!
      raise(SkipLink)
    end

    #
    # Causes the agent to skip the page being visited.
    #
    # @raises [SkipPage]
    #   Indicates to the agent, that the current page should be skipped.
    #
    def skip_page!
      raise(SkipPage)
    end
  end
end

{'fraction_non_alphanumeric': 0.08309037900874636, 'fraction_numerical': 0.0, 'mean_word_length': 2.053392658509455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5189246', 'n_tokens_mistral': 916, 'n_tokens_neox': 872, 'n_words': 282}