Method: Scruber::Core::Crawler#on_complete

Defined in:
lib/scruber/core/crawler.rb

#on_complete(priority = 1, &block) ⇒ void

This method returns an undefined value.

Register callback which will be executed when downloading and parsing will be completed. For example when you need to write results to file, or to close files.

Examples:

Close file descriptors

on_complete -1 do
  Scruber::Core::Extensions::CsvOutput.close_all
end

Parameters:

  • priority (Integer) (defaults to: 1)

    priority of this callback

  • block (Proc)

    body of callback



161
162
163
# File 'lib/scruber/core/crawler.rb', line 161

def on_complete(priority=1, &block)
  @on_complete_callbacks.push [priority,block]
end