Sha256: 883d7e6624e3c1408108d110b80d1d1a6a23938a094cc5dbd4d0932f09f77736

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

# Worker

Thread safe inter-process synchronous workers using Ruby Queue

    adder = Worker.new do |a,b|
      a + b
    end

    multiplier = Worker.new do |a,b|
      a * b
    end

    puts adder.perform 1, 2
    # => 3
    puts multiplier.perform 10, 2
    # => 20

Scoped instance variables:

    adder_memo = Worker.new do |a,b|
      @sum ||= 0
      @sum += a + b
    end

    puts adder_memo.perform 1, 2
    # => 3
    puts adder_memo.perform 1, 2
    # => 6

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
worker-0.6.0 README.md
worker-0.3.0 README.md
worker-0.2.0 README.md