Skip to content

Commit 095260b

Browse files
committed
Drop support for Ruby v3.1 and related compatibility shims.
1 parent 437515e commit 095260b

4 files changed

Lines changed: 3 additions & 18 deletions

File tree

.github/workflows/test-coverage.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ jobs:
1717
strategy:
1818
matrix:
1919
include:
20-
- os: ubuntu
21-
ruby: "3.1"
22-
io_event_selector: EPoll
2320
- os: ubuntu
2421
ruby: "3.2"
2522
io_event_selector: EPoll

.github/workflows/test-external.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
- macos
2121

2222
ruby:
23-
- "3.1"
2423
- "3.2"
2524
- "3.3"
2625
- "3.4"

.github/workflows/test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
- macos
2222

2323
ruby:
24-
- "3.1"
2524
- "3.2"
2625
- "3.3"
2726
- "3.4"

lib/async/scheduler.rb

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,6 @@ def address_resolve(hostname)
269269
::Resolv.getaddresses(hostname)
270270
end
271271

272-
if IO.method_defined?(:timeout)
273-
private def get_timeout(io)
274-
io.timeout
275-
end
276-
else
277-
private def get_timeout(io)
278-
nil
279-
end
280-
end
281-
282272
# Wait for the specified IO to become ready for the specified events.
283273
#
284274
# @public Since *Async v2*.
@@ -295,7 +285,7 @@ def io_wait(io, events, timeout = nil)
295285
timer = @timers.after(timeout) do
296286
fiber.transfer
297287
end
298-
elsif timeout = get_timeout(io)
288+
elsif timeout = io.timeout
299289
# Otherwise, if we default to the io's timeout, we raise an exception:
300290
timer = @timers.after(timeout) do
301291
fiber.raise(::IO::TimeoutError, "Timeout (#{timeout}s) while waiting for IO to become ready!")
@@ -320,7 +310,7 @@ def io_wait(io, events, timeout = nil)
320310
def io_read(io, buffer, length, offset = 0)
321311
fiber = Fiber.current
322312

323-
if timeout = get_timeout(io)
313+
if timeout = io.timeout
324314
timer = @timers.after(timeout) do
325315
fiber.raise(::IO::TimeoutError, "Timeout (#{timeout}s) while waiting for IO to become readable!")
326316
end
@@ -344,7 +334,7 @@ def io_read(io, buffer, length, offset = 0)
344334
def io_write(io, buffer, length, offset = 0)
345335
fiber = Fiber.current
346336

347-
if timeout = get_timeout(io)
337+
if timeout = io.timeout
348338
timer = @timers.after(timeout) do
349339
fiber.raise(::IO::TimeoutError, "Timeout (#{timeout}s) while waiting for IO to become writable!")
350340
end

0 commit comments

Comments
 (0)