lib/queue_classic/queue.rb
def enqueue(method, *args)
      QC.log_yield(:measure => 'queue.enqueue') do
        s = "INSERT INTO #{QC.table_name} (q_name, method, args) VALUES ($1, $2, $3) RETURNING id"
        conn_adapter.execute(s, name, method, JSON.dump(args))
      end
    end
def enqueue(method, *args)
      QC.log_yield(:measure => 'queue.enqueue') do
        s = "INSERT INTO #{QC.table_name} (q_name, method, args) VALUES ($1, $2, $3) RETURNING id"
        conn_adapter.execute(s, name, method, JSON.dump(args))
      end
    end
enqueue(m,a) inserts a row into the jobs table and trigger a notification.
 The job's queue is represented by a name column in the row.
 There is a trigger on the table which will send a NOTIFY event
 on a channel which corresponds to the name of the queue.
 The method argument is a string encoded ruby expression. The expression
 will be separated by a `.` character and then `eval`d.
 Examples of the method argument include: `puts`, `Kernel.puts`,
 `MyObject.new.puts`.
 The args argument will be encoded as JSON and stored as a JSON datatype
 in the row. (If the version of PG does not support JSON,
 then the args will be stored as text.
 The args are stored as a collection and then splatted inside the worker.
 Examples of args include: `'hello world'`, `['hello world']`,
 `'hello', 'world'`.
 This method returns a hash with the id of the enqueued job.