io-stream 0.12.0 → 0.13.0

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: 2c6d9477b767c150a9cf33bc11f6889f33a15a86da4814bdd90bc57eba91d47c
4
- data.tar.gz: fc9981e2657df9a82471e2d80de424c87186d64f356a6a06966d2723d137ae4e
3
+ metadata.gz: 19adcce8b9c2b4ab09e119675d2df7f030bb2a25b38774701e120bc8a75e2275
4
+ data.tar.gz: 942defa1b08a973b860d20d84a411317433f04eb8361c32c9b1b87f7bed16686
5
5
  SHA512:
6
- metadata.gz: a20fee7d1e21a51b8604502f7e90b90acfd46131fcde7f33639f9cdeccd570de733a64d0d7290beb1625857c9531242c37f45d673add9bc41444f5d424290dab
7
- data.tar.gz: 3f78ca242a41714a6b3768b593b44c63669b50a72be93a7e9ad0eab6e2e0eaa5c9a80d914f36894f3cd3cd8e6fc4f845c9f2ca2d14762754016bd071542bae5b
6
+ metadata.gz: 7971599b56a27229f68d57b1907ca008c41041e38eb02285accd9f5d149ed5aa177d2e3eb9a1ea947dc8bab7d72ba8ba83ae59a53790d978d23c082d243d2789
7
+ data.tar.gz: 43c37664380b989b04183a033184d5b7f2443c83160e88d2edd6628edbbe5192ca3ba2de876560496622be0335882025b86ab9e13722e3eeb0906b541414ec6a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -106,4 +106,17 @@ module IO::Stream
106
106
  @output.wait_writable(duration)
107
107
  end
108
108
  end
109
+
110
+ # Construct a buffered stream from either one duplex IO-like object or two separate endpoints.
111
+ # @parameter input [IO] The duplex IO object, or the readable endpoint.
112
+ # @parameter output [IO | Nil] The writable endpoint, when distinct from the readable endpoint.
113
+ # @parameter options [Hash] Additional options passed to the buffered stream wrapper.
114
+ # @returns [IO::Stream::Buffered] A buffered stream wrapping the supplied transport.
115
+ def self.Duplex(input, output = nil, **options)
116
+ if output
117
+ Buffered.wrap(Duplex.new(input, output), **options)
118
+ else
119
+ ::IO.Stream(input)
120
+ end
121
+ end
109
122
  end
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2023-2025, by Samuel Williams.
5
5
 
6
6
  module IO::Stream
7
- VERSION = "0.12.0"
7
+ VERSION = "0.13.0"
8
8
  end
data/lib/io/stream.rb CHANGED
@@ -9,18 +9,6 @@ require_relative "stream/duplex"
9
9
 
10
10
  # @namespace
11
11
  class IO
12
- # @namespace
13
- module Stream
14
- # Construct a buffered duplex stream from separate input and output endpoints.
15
- # @parameter input [IO] The readable endpoint.
16
- # @parameter output [IO] The writable endpoint.
17
- # @parameter options [Hash] Additional options passed to the buffered stream wrapper.
18
- # @returns [IO::Stream::Buffered] A buffered stream wrapping a duplex transport.
19
- def self.Duplex(input, output = input, **options)
20
- Buffered.wrap(Duplex.new(input, output), **options)
21
- end
22
- end
23
-
24
12
  # Convert any IO-like object into a buffered stream.
25
13
  # @parameter io [IO] The IO object to wrap.
26
14
  # @returns [IO::Stream::Buffered] A buffered stream wrapper.
data/readme.md CHANGED
@@ -22,6 +22,10 @@ Please see the [project documentation](https://socketry.github.io/io-stream/) fo
22
22
 
23
23
  Please see the [project releases](https://socketry.github.io/io-stream/releases/index) for all releases.
24
24
 
25
+ ### v0.13.0
26
+
27
+ - `IO::Stream::Duplex(io)` is equivalent to `IO::Stream(io)`.
28
+
25
29
  ### v0.12.0
26
30
 
27
31
  - Introduce `IO::Stream::Duplex` as a low-level duplex transport for composing separate input and output endpoints.
@@ -65,11 +69,6 @@ Please see the [project releases](https://socketry.github.io/io-stream/releases/
65
69
 
66
70
  - Improve compatibility of `gets` implementation to better match Ruby's IO\#gets behavior.
67
71
 
68
- ### v0.5.0
69
-
70
- - Add support for `read_until(limit:)` parameter to limit the amount of data read.
71
- - Minor documentation improvements.
72
-
73
72
  ## See Also
74
73
 
75
74
  - [async-io](https://github.com/socketry/async-io) — Where this implementation originally came from.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.13.0
4
+
5
+ - `IO::Stream::Duplex(io)` is equivalent to `IO::Stream(io)`.
6
+
3
7
  ## v0.12.0
4
8
 
5
9
  - Introduce `IO::Stream::Duplex` as a low-level duplex transport for composing separate input and output endpoints.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file