Module: SidekiqUniqueJobs::Script::DSL::ClassMethods

Defined in:
lib/sidekiq_unique_jobs/script/dsl.rb

Overview

Module ClassMethods extends the base class with necessary methods

Author:

Instance Method Summary collapse

Instance Method Details

#configScript::Config

The current configuration (See: #configure on how to configure)

Returns:



52
53
54
55
56
# File 'lib/sidekiq_unique_jobs/script/dsl.rb', line 52

def config
  MUTEX.synchronize do
    @config ||= Config.new
  end
end

#configure(options = {}) { ... } ⇒ Object

Configure the gem

This is usually called once at startup of an application

Parameters:

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

    global gem options

Options Hash (options):

  • :path (String, Pathname)
  • :logger (Logger) — default: default is Logger.new(STDOUT)

Yields:

  • control to the caller when given block



36
37
38
39
40
41
42
43
44
# File 'lib/sidekiq_unique_jobs/script/dsl.rb', line 36

def configure(options = {})
  if block_given?
    yield config
  else
    options.each do |key, val|
      config.send(:"#{key}=", val)
    end
  end
end

#execute(file_name, conn, keys: [], argv: []) ⇒ Object



23
24
25
26
27
# File 'lib/sidekiq_unique_jobs/script/dsl.rb', line 23

def execute(file_name, conn, keys: [], argv: [])
  SidekiqUniqueJobs::Script::Client
    .new(config)
    .execute(file_name, conn, keys: keys, argv: argv)
end