Sha256: 3ea1b070b144182a63d03df71d11395f2a34e775c9b365a60ad4a79980d6880f

Contents?: true

Size: 432 Bytes

Versions: 2

Compression:

Stored size: 432 Bytes

Contents

module RCelery
  class Task
    class Context
      def initialize(name)
        @key = "#{name}.request"
      end

      def update(options = {})
        Thread.current[@key] = options
      end

      def clear
        update
      end

      def method_missing(method, *args)
        if args.length.zero?
          Thread.current[@key][method]
        else
          super(method, *args)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rcelery-1.0.1 lib/rcelery/task/context.rb
rcelery-1.0.0 lib/rcelery/task/context.rb