async 2.35.2 → 2.35.3

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: 28fcbed588ccb0c02ebed08bfc2d316b07e34563cb52fc639f33d5146c7ca9bc
4
- data.tar.gz: b9319321c6acb3a6d48b0e76a2afbc3c017586855c6c842950eb0376db8b1bbb
3
+ metadata.gz: 7c439d8ba1591623b695ccd1dd4fe68f822fedd589291a7bdd79a53ce9c430d7
4
+ data.tar.gz: cc8902bc5b15f446df404967e1832c9847eb0bcad879565508f6688bd0a5c92a
5
5
  SHA512:
6
- metadata.gz: 689e40bffc89b7bc39c1358ef9ab69b5bd49f5840790ebd8e3ebbcfe09d4edbefcd3813e7d4ab8165783a6613624cb1625921140ecb45c124dafc6b5dc424425
7
- data.tar.gz: 658be41e0d4d602f3a6167f5c380268eff5000114dd117d0edbe0ba8ddda25061935119f07d2f21e286892f46f33b779c785d9104de5a3f4cea10d661a42e093
6
+ metadata.gz: c2bfeb61c9f9ddad7576c66be0b637bee5934159e9388fe21cd0b1e8e5df804b5818194ef812d6249570411591d232a4c570fc6c6bcd02d67496e7aaf8950467
7
+ data.tar.gz: 2454b411f93e6e86e25030bdd358eba7ed38536928ab64dc64b1dc10e3dff152ac4005ad27bdf3d4e801c49d69c2b386f7ca08961d90015dbe86fa2e9bccc5cf
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/async/clock.rb CHANGED
@@ -36,6 +36,9 @@ module Async
36
36
  @started = nil
37
37
  end
38
38
 
39
+ # @returns [Numeric | Nil] The time when the clock was started, or nil if not started.
40
+ attr :started
41
+
39
42
  # Start measuring a duration.
40
43
  def start!
41
44
  @started ||= Clock.now
@@ -70,5 +73,22 @@ module Async
70
73
  @started = Clock.now
71
74
  end
72
75
  end
76
+
77
+ # Convert the clock to a JSON-compatible hash.
78
+ #
79
+ # @returns [Hash] The JSON-compatible hash.
80
+ def as_json(...)
81
+ {
82
+ started: self.started,
83
+ total: self.total,
84
+ }
85
+ end
86
+
87
+ # Convert the clock to a JSON string.
88
+ #
89
+ # @returns [String] The JSON string.
90
+ def to_json(...)
91
+ self.as_json.to_json(...)
92
+ end
73
93
  end
74
94
  end
data/lib/async/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2025, by Samuel Williams.
5
5
 
6
6
  module Async
7
- VERSION = "2.35.2"
7
+ VERSION = "2.35.3"
8
8
  end
data/readme.md CHANGED
@@ -35,6 +35,10 @@ Please see the [project documentation](https://socketry.github.io/async/) for mo
35
35
 
36
36
  Please see the [project releases](https://socketry.github.io/async/releases/index) for all releases.
37
37
 
38
+ ### v2.35.3
39
+
40
+ - `Async::Clock` now implements `#as_json` and `#to_json` for nicer log formatting.
41
+
38
42
  ### v2.35.2
39
43
 
40
44
  - Improved handling of `Process.fork` on Ruby 4+.
@@ -75,16 +79,6 @@ Please see the [project releases](https://socketry.github.io/async/releases/inde
75
79
  - Add `closed?` method to `Async::PriorityQueue` for full queue interface compatibility.
76
80
  - Support non-blocking operations using `timeout: 0` parameter.
77
81
 
78
- ### v2.29.0
79
-
80
- This release introduces thread-safety as a core concept of Async. Many core classes now have thread-safe guarantees, allowing them to be used safely across multiple threads.
81
-
82
- - Thread-safe `Async::Condition` and `Async::Notification`, implemented using `Thread::Queue`.
83
- - Thread-safe `Async::Queue` and `Async::LimitedQueue`, implemented using `Thread::Queue` and `Thread::LimitedQueue` respectively.
84
- - `Async::Variable` is deprecated in favor of `Async::Promise`.
85
- - [Introduce `Async::Promise`](https://socketry.github.io/async/releases/index#introduce-async::promise)
86
- - [Introduce `Async::PriorityQueue`](https://socketry.github.io/async/releases/index#introduce-async::priorityqueue)
87
-
88
82
  ## See Also
89
83
 
90
84
  - [async-http](https://github.com/socketry/async-http) — Asynchronous HTTP client/server.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v2.35.3
4
+
5
+ - `Async::Clock` now implements `#as_json` and `#to_json` for nicer log formatting.
6
+
3
7
  ## v2.35.2
4
8
 
5
9
  - Improved handling of `Process.fork` on Ruby 4+.
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.35.2
4
+ version: 2.35.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file