Sha256: 3118689109077ee326005c42ad7e5890d429b61b387a60e455a7f9b81a25dd89

Contents?: true

Size: 671 Bytes

Versions: 13

Compression:

Stored size: 671 Bytes

Contents

module Sidekiq
  module Extensions
    class Proxy < (RUBY_VERSION < '1.9' ? Object : BasicObject)
      def initialize(performable, target)
        @performable = performable
        @target = target
      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.perform_async(::YAML.dump(obj))
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
kulesa-sidekiq-1.2.3 lib/sidekiq/extensions/generic_proxy.rb
kulesa-sidekiq-1.2.2 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-1.2.1 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-1.2.0 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-1.1.4 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-1.1.3 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-1.1.2 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-1.1.1 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-1.1.0 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-1.0.0 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-0.11.2 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-0.11.1 lib/sidekiq/extensions/generic_proxy.rb
sidekiq-0.11.0 lib/sidekiq/extensions/generic_proxy.rb