Sha256: 2378e6e0f92f1c4ec808d17877403699e461c4054e089e0b7d1123b66f98f95a

Contents?: true

Size: 439 Bytes

Versions: 5

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

# Namespace for the Aw library.
#
# @api public
#
# @example Fork and return 42 from 6 * 7.
#   Aw.fork! { 6 * 7 } # => 42
module Aw
  # Run the block inside a subprocess, and return the value.
  #
  # @param block [Proc] The code to run in a subprocess.
  #
  # @return [#object_id] The result.
  def self.fork!(&block)
    Fork.new(*IO.pipe).call(&block)
  end
end

require_relative File.join 'aw', 'fork'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aw-0.1.6 lib/aw.rb
aw-0.1.5 lib/aw.rb
aw-0.1.4 lib/aw.rb
aw-0.1.3 lib/aw.rb
aw-0.1.2 lib/aw.rb