Module: Resque::Helpers

Included in:
Resque, Job, Job, Worker, Worker
Defined in:
lib/resque/helpers.rb

Overview

Methods used by various classes in Resque.

Defined Under Namespace

Classes: DecodeException

Instance Method Summary collapse

Instance Method Details

#classify(dashed_word) ⇒ Object

Given a word with dashes, returns a camel cased version of it.



44
45
46
# File 'lib/resque/helpers.rb', line 44

def classify(dashed_word)
  Resque.classify(dashed_word)
end

#constantize(camel_cased_word) ⇒ Object

Tries to find a constant with the name specified in the argument string



49
50
51
# File 'lib/resque/helpers.rb', line 49

def constantize(camel_cased_word)
  Resque.constantize(camel_cased_word)
end

#decode(object) ⇒ Object

Given a string, returns a Ruby object.



39
40
41
# File 'lib/resque/helpers.rb', line 39

def decode(object)
  Resque.decode(object)
end

#encode(object) ⇒ Object

Given a Ruby object, returns a string suitable for storage in a queue.



34
35
36
# File 'lib/resque/helpers.rb', line 34

def encode(object)
  Resque.encode(object)
end

#redisObject

Direct access to the Redis instance.



22
23
24
25
26
27
28
29
30
# File 'lib/resque/helpers.rb', line 22

def redis
  # No infinite recursions, please.
  # Some external libraries depend on Resque::Helpers being mixed into
  # Resque, but this method causes recursions. If we have a super method,
  # assume it is canonical. (see #1150)
  return super if defined?(super)

  Resque.redis
end