Class: Redis::Scripting::Module
- Inherits:
-
Object
- Object
- Redis::Scripting::Module
- Defined in:
- lib/redis/scripting/module.rb
Instance Attribute Summary collapse
-
#redis ⇒ Object
Returns the value of attribute redis.
-
#source_dir ⇒ Object
readonly
Returns the value of attribute source_dir.
Instance Method Summary collapse
-
#initialize(redis, source_dir, opts = {}) ⇒ Module
constructor
A new instance of Module.
- #inspect ⇒ Object
- #run(script_name, keys, argv) ⇒ Object
Constructor Details
#initialize(redis, source_dir, opts = {}) ⇒ Module
Returns a new instance of Module.
11 12 13 14 15 16 |
# File 'lib/redis/scripting/module.rb', line 11 def initialize(redis, source_dir, opts = {}) @redis = redis @source_dir = source_dir @scripts = {} load_scripts() end |
Instance Attribute Details
#redis ⇒ Object
Returns the value of attribute redis.
9 10 11 |
# File 'lib/redis/scripting/module.rb', line 9 def redis @redis end |
#source_dir ⇒ Object (readonly)
Returns the value of attribute source_dir.
8 9 10 |
# File 'lib/redis/scripting/module.rb', line 8 def source_dir @source_dir end |
Instance Method Details
#inspect ⇒ Object
25 26 27 |
# File 'lib/redis/scripting/module.rb', line 25 def inspect %{<%s: 0x%x @source_dir="%s" @redis=%s>} % [self.class, object_id, source_dir, redis] end |
#run(script_name, keys, argv) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/redis/scripting/module.rb', line 18 def run(script_name, keys, argv) script = @scripts[script_name.to_s] raise(ArgumentError, "unknown script: #{script_name}") unless script script.run(redis, keys, argv) end |