Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jroesch/woven
A place for experiments with Ruby concurrency primitives
https://github.com/jroesch/woven
Last synced: 23 days ago
JSON representation
A place for experiments with Ruby concurrency primitives
- Host: GitHub
- URL: https://github.com/jroesch/woven
- Owner: jroesch
- Created: 2014-07-09T05:20:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-23T18:47:18.000Z (about 10 years ago)
- Last Synced: 2023-08-06T07:05:52.757Z (over 1 year ago)
- Language: Ruby
- Size: 438 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Woven
## What is Woven?
Woven is built on top of `em_synchrony` in order to take advantage of its event-driven I/O and concurrency model.
It provides a clean interface for using Promises's and Future's similar to Scala and JavaScript in an asychronous style. Go Channels are also implemented on top of `em_synchrony`.Futures are composable so new futures can created in an asynchronous manner.
### An example of using Woven with Futures
Here is an example of how to use futures in Woven.
```ruby
f3 = nil
Woven.run do
f1 = future { "Hello, " }
f2 = future { "world!" }f3 = f1 + f2 # You can combine two futures together
end
```To get access to the value within the future.
```ruby
f3.value => "Hello, world!"
```### An example of using Woven with Channels
Here is an example of how to use channels in Woven.
```ruby
c = Channel.new
value = nil
Woven.run do
future { c.send(1) }
future { value = c.receive }
endputs value => 1
```