Sha256: 6d9a5b78115e075f4b5c7b69e991da831e95f2a026d63ba558d951a3939cd1d6
Contents?: true
Size: 771 Bytes
Versions: 15
Compression:
Stored size: 771 Bytes
Contents
# frozen_string_literal: true 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
15 entries across 15 versions & 2 rubygems