Module: Que::Unique

Extended by:
ActiveSupport::Concern
Defined in:
lib/que/unique.rb,
lib/que/unique/version.rb,
lib/que/unique/constants.rb,
lib/que/unique/transaction_class_methods.rb

Defined Under Namespace

Modules: TransactionClassMethods

Constant Summary collapse

VERSION =
"1.1.0"
THREAD_LOCAL_KEY =
:que_unique_thread_local
THREAD_LOCAL_DEPTH_KEY =
:que_unique_thread_local_depth

Class Method Summary collapse

Class Method Details

.canonicalise_que_unique_arg(value) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/que/unique.rb', line 43

def canonicalise_que_unique_arg(value)
  case value
  when Class
    # When we try to enqueue a Class as an arg (very common), to_json chokes.
    # We must convert it to a string manually.
    value.to_s
  when Hash
    # Hashes are sorted by insertion order by default, so instead, create a new
    # hash sorted by key/value pairs.
    value.sort.to_h
  else
    value
  end
end