Class: Punchline::MinQueue::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/punchline/min_queue.rb

Constant Summary collapse

SCRIPT_BASE_PATH =
File.expand_path('../lua', __FILE__)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(redis, script_name) ⇒ Script

Returns a new instance of Script.



61
62
63
64
# File 'lib/punchline/min_queue.rb', line 61

def initialize(redis, script_name)
  @redis = redis
  @script_name = script_name
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



59
60
61
# File 'lib/punchline/min_queue.rb', line 59

def body
  @body
end

#redisObject

Returns the value of attribute redis.



59
60
61
# File 'lib/punchline/min_queue.rb', line 59

def redis
  @redis
end

#script_nameObject

Returns the value of attribute script_name.



59
60
61
# File 'lib/punchline/min_queue.rb', line 59

def script_name
  @script_name
end

#shaObject

Returns the value of attribute sha.



59
60
61
# File 'lib/punchline/min_queue.rb', line 59

def sha
  @sha
end

Instance Method Details

#call(keys = [], argv = []) ⇒ Object



66
67
68
69
# File 'lib/punchline/min_queue.rb', line 66

def call(keys = [], argv = [])
  load! unless @body
  @redis.evalsha sha, keys, argv
end