Sha256: 57ef4f9ef46ac89347f861aecd7ce4dfdec3fb04bdd62c67a73e2db6eae3f0d8

Contents?: true

Size: 440 Bytes

Versions: 8

Compression:

Stored size: 440 Bytes

Contents

require 'slave'
#
# if no slave object is given the block itself is used to contruct it 
#
  class Server
    def initialize
      "this is run only in the child"
      @pid = Process.pid
    end
    attr 'pid'
  end

  slave = Slave.new{ Server.new }
  server = slave.object

  p Process.pid
  p server.pid # not going to be the same as parents!
#
# errors are still detected though
#
  slave = Slave.new{ fubar } # raises error in parent

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
slave-1.3.2 samples/c.rb
slave-1.3.1 samples/c.rb
slave-1.3.0 samples/c.rb
slave-1.2.2 samples/c.rb
slave-1.0.0 samples/c.rb
slave-1.2.0 samples/c.rb
slave-1.1.0 samples/c.rb
slave-1.2.1 samples/c.rb