Sha256: f5fa92be68d7878cf405ceda259d8382e39421c8d705787c5c55a5f89ec7f3eb

Contents?: true

Size: 442 Bytes

Versions: 5

Compression:

Stored size: 442 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.11 lib/aw.rb
aw-0.1.10 lib/aw.rb
aw-0.1.9 lib/aw.rb
aw-0.1.8 lib/aw.rb
aw-0.1.7 lib/aw.rb