Sha256: c0be0b359039ac882bbda79aac73a0a0f1a23f5e0be9c76100480c9a45353ff3
Contents?: true
Size: 741 Bytes
Versions: 57
Compression:
Stored size: 741 Bytes
Contents
require 'yaml' module Sidekiq module Extensions class Proxy < BasicObject def initialize(performable, target, options={}) @performable = performable @target = target @opts = options end def method_missing(name, *args) # Sidekiq has a limitation in that its message must be JSON. # JSON can't round trip real Ruby objects so we use YAML to # serialize the objects to a String. The YAML will be converted # to JSON and then deserialized on the other side back into a # Ruby object. obj = [@target, name, args] @performable.client_push({ 'class' => @performable, 'args' => [::YAML.dump(obj)] }.merge(@opts)) end end end end
Version data entries
57 entries across 57 versions & 1 rubygems