Module: Aw

Defined in:
lib/aw.rb,
lib/aw/fork.rb

Overview

Namespace for the Aw library.

Examples:

Fork and return 42 from 6 * 7.

Aw.fork! { 6 * 7 } # => 42

Defined Under Namespace

Classes: Fork

Class Method Summary collapse

Class Method Details

.fork!(&block) ⇒ #object_id

Run the block inside a subprocess, and return the value.

Parameters:

  • block (Proc)

    The code to run in a subprocess.

Returns:

  • (#object_id)

    The result.



15
16
17
# File 'lib/aw.rb', line 15

def self.fork!(&block)
  Fork.new(*::IO.pipe).call(&block)
end