Module: Brpoplpush::RedisScript::DSL::ClassMethods

Defined in:
lib/brpoplpush/redis_script/dsl.rb

Overview

Module ClassMethods extends the base class with necessary methods

Author:

Instance Method Summary collapse

Instance Method Details

#configRedisScript::Config

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

Returns:



54
55
56
# File 'lib/brpoplpush/redis_script/dsl.rb', line 54

def config
  @config ||= Config.new
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



38
39
40
41
42
43
44
45
46
# File 'lib/brpoplpush/redis_script/dsl.rb', line 38

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



25
26
27
28
29
# File 'lib/brpoplpush/redis_script/dsl.rb', line 25

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