async 2.44.0 → 2.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7ec9caa7a2e151195fa3da29d96fb2fe0f02399b89d17d93eeb7507667596ad
4
- data.tar.gz: ed1548c91c789ef1ffbc268a1470cde4f1d1dc1ffed12678825e1d253b0a8d67
3
+ metadata.gz: 0a98ba175586bacb13a3f00ccb770083208e4c8381cbaf17ce4f59fdfc56a85a
4
+ data.tar.gz: 6a8614f33cbfa4230e66e12750308a1a339d9a2d6fe8a624b015498c5bc60928
5
5
  SHA512:
6
- metadata.gz: d8cc76cc2cc6f3a19ce94383b4123e83b9274a3431b9dc2fc71bfff62946ef3dbad0b4c8f4c607b3071d219b5efc73315d589b10e4467c26e60bbd48eb2c6103
7
- data.tar.gz: b914c7f81337ce52ae1aadb42b43f0d702c94847ae0052d326ee510a57c87517b957b5c0fd70988d9b08d4d9f061348b93dceaaf194b3d19ab809eb45c0387f7
6
+ metadata.gz: 0d3c4cd7e58f0eb601e37ffbf8d415c6b66349f268f2b9bec37ed4a945744409ecdb21f13e101cacba2794ea1dd3e6dd3be7a5cf7ca6cc5e67cd557bd65cd11e
7
+ data.tar.gz: dc2c1d73dc53df633260e279a20f8cbcb4c40c94b362fc383495e020f750807624c2de5bff446732585b5e2b4121b0ec382de65983db3af23301e937b96b4074
checksums.yaml.gz.sig CHANGED
Binary file
@@ -74,6 +74,42 @@ end
74
74
  puts "The number was: #{task.wait}"
75
75
  ```
76
76
 
77
+ ### Comparing `Async` and `Sync`
78
+
79
+ If you are familiar with JavaScript's `async`/`await`, `Async{...}` is similar to calling an asynchronous function: it starts the work and returns a promise-like {ruby Async::Task} that you can wait on later.
80
+
81
+ ```ruby
82
+ task = Async do
83
+ bar
84
+ end
85
+
86
+ task.wait # Returns the value of bar.
87
+ ```
88
+
89
+ This is similar to JavaScript code that keeps the promise:
90
+
91
+ ```javascript
92
+ const promise = bar();
93
+
94
+ await promise; // Returns the value of bar.
95
+ ```
96
+
97
+ `Sync{...}` is similar to immediately awaiting that work: it runs the block in an event loop and returns the block's value directly.
98
+
99
+ ```ruby
100
+ result = Sync do
101
+ bar
102
+ end
103
+ ```
104
+
105
+ This is similar to:
106
+
107
+ ```javascript
108
+ const result = await bar();
109
+ ```
110
+
111
+ The main difference is that JavaScript starts with an event loop already available, while Ruby code needs one to be provided by a fiber scheduler. `Sync{...}` is the usual way to create or reuse that event loop when the caller wants a direct return value instead of a task.
112
+
77
113
  ## Creating a Fiber Scheduler
78
114
 
79
115
  The first (top level) async block will also create an instance of {ruby Async::Reactor} which is a subclass of {ruby Async::Scheduler} to handle the event loop. You can also do this directly using {ruby Fiber.set_scheduler}:
data/context/index.yaml CHANGED
@@ -3,6 +3,8 @@
3
3
  ---
4
4
  description: A concurrency framework for Ruby.
5
5
  metadata:
6
+ bug_tracker_uri: https://github.com/socketry/async/issues
7
+ changelog_uri: https://github.com/socketry/async/blob/main/releases.md
6
8
  documentation_uri: https://socketry.github.io/async/
7
9
  funding_uri: https://github.com/sponsors/ioquatix/
8
10
  source_code_uri: https://github.com/socketry/async.git
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2017-2025, by Samuel Williams.
4
+ # Copyright, 2017-2026, by Samuel Williams.
5
5
  # Copyright, 2017, by Kent Gruber.
6
6
  # Copyright, 2026, by Robert Mosolgo.
7
7
 
data/lib/async/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
 
6
6
  # @namespace
7
7
  module Async
8
- VERSION = "2.44.0"
8
+ VERSION = "2.44.1"
9
9
  end
data/lib/kernel/async.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2024, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
  # Copyright, 2026, by Shopify Inc.
6
6
 
7
7
  require_relative "../async/reactor"
data/lib/kernel/sync.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2025, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
  # Copyright, 2020, by Brian Morearty.
6
6
  # Copyright, 2024, by Patrik Wenger.
7
7
  # Copyright, 2025-2026, by Shopify Inc.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.44.0
4
+ version: 2.44.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -173,6 +173,8 @@ homepage: https://github.com/socketry/async
173
173
  licenses:
174
174
  - MIT
175
175
  metadata:
176
+ bug_tracker_uri: https://github.com/socketry/async/issues
177
+ changelog_uri: https://github.com/socketry/async/blob/main/releases.md
176
178
  documentation_uri: https://socketry.github.io/async/
177
179
  funding_uri: https://github.com/sponsors/ioquatix/
178
180
  source_code_uri: https://github.com/socketry/async.git
metadata.gz.sig CHANGED
Binary file