Module: Scruber::Core::Extensions::Loop::CoreMethods

Included in:
Helpers::ProxyRotator::Configuration, Helpers::UserAgentRotator::Configuration
Defined in:
lib/scruber/core/extensions/loop.rb

Instance Method Summary collapse

Instance Method Details

#add_dictionary(name, file_path, file_type) ⇒ void

This method returns an undefined value.

Registering dictionary in system

Parameters:

  • name (Symbol)

    name of dictionary

  • file_path (String)

    path to file

  • file_type (Symbol)

    type of file, :xml, :csv, etc..



42
43
44
# File 'lib/scruber/core/extensions/loop.rb', line 42

def add_dictionary(name, file_path, file_type)
  Scruber::Core::Extensions::Loop.add_dictionary(name, file_path, file_type)
end

#loop(dictionary, options = {}, &block) ⇒ void

This method returns an undefined value.

Iterate records from dictionary

Parameters:

  • dictionary (Symbol)

    name of dictionary

  • options (Hash) (defaults to: {})

    search conditions

  • block (Proc)

    body, yields row of dictionary



28
29
30
31
32
# File 'lib/scruber/core/extensions/loop.rb', line 28

def loop(dictionary, options={}, &block)
  Scruber::Core::Extensions::Loop.loop dictionary, options do |*args|
    instance_exec *args, &block
  end
end