Aw

Version Yard documentation CI RuboCop License

Aw, fork! 😬

Creates a sub-process to execute a block inside, and return the result.

Installation

Add this line to your application's Gemfile:

gem "aw"

And then execute:

bundle

Or install it yourself as:

gem install aw

Usage

Execute a block of code in a sub-process, and return the result to the current process:

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

Therefore, when the execution of a block of code causes side effects, they are limited to the sub-process:

arr = ["foo"]

Aw.fork! { arr << "FUU" } # => ["foo", "FUU"]

arr # => ["foo"]

Exceptions raised within a block of code are propagated:

Aw.fork! { nil + 1 } # => NoMethodError (undefined method `+' for nil:NilClass)

Contact

Versioning

Aw follows Semantic Versioning 2.0.

License

The gem is available as open source under the terms of the MIT License.


This project is sponsored by:
Sashite