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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/clock.rb +20 -0
- data/lib/async/version.rb +1 -1
- data/readme.md +4 -10
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c439d8ba1591623b695ccd1dd4fe68f822fedd589291a7bdd79a53ce9c430d7
|
|
4
|
+
data.tar.gz: cc8902bc5b15f446df404967e1832c9847eb0bcad879565508f6688bd0a5c92a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
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
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|