Skip to content

Commit 965ca28

Browse files
committed
Small cleanups
1 parent 134c670 commit 965ca28

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/truffle/io/wait.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# truffleruby_primitives: true
2+
13
# Copyright (c) 2017, 2023 Oracle and/or its affiliates. All rights reserved. This
24
# code is released under a tri EPL/GPL/LGPL license. You can use it,
35
# redistribute it and/or modify it under the terms of the:
@@ -47,17 +49,15 @@ def wait_priority(timeout = nil)
4749
#
4850
# Optional parameter +mode+ is one of +:read+, +:write+, or
4951
# +:read_write+.
50-
#
5152
def wait(*args)
5253
ensure_open
5354

54-
if args.size != 2 || args[0].is_a?(Symbol) || args[1].is_a?(Symbol)
55+
if args.size != 2 || Primitive.object_kind_of?(args[0], Symbol) || Primitive.object_kind_of?(args[1], Symbol)
5556
# Slow/messy path:
56-
5757
timeout = :undef
5858
events = 0
5959
args.each do |arg|
60-
if arg.is_a?(Symbol)
60+
if Primitive.object_kind_of?(arg, Symbol)
6161
events |= case arg
6262
when :r, :read, :readable then IO::READABLE
6363
when :w, :write, :writable then IO::WRITABLE
@@ -80,9 +80,8 @@ def wait(*args)
8080
res = Truffle::IOOperations.poll(self, events, timeout)
8181
res == 0 ? nil : self
8282
else
83-
# argc == 2 and neither are symbols
83+
# args.size == 2 and neither are symbols
8484
# This is the fast path and the new interface:
85-
8685
events, timeout = *args
8786
raise ArgumentError, 'Events must be positive integer!' if events <= 0
8887
res = Truffle::IOOperations.poll(self, events, timeout)

src/main/ruby/truffleruby/core/truffle/io_operations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def self.select(readables, readable_ios, writables, writable_ios, errorables, er
206206
end
207207

208208
# This method will return an event mask if poll returned without error.
209-
# The event mask is >0 when an event occured within the timeout, 0 if the timeout expired.
209+
# The event mask is > 0 when an event occurred within the timeout, 0 if the timeout expired.
210210
# Raises an exception for an errno.
211211
def self.poll(io, event_mask, timeout)
212212
if (event_mask & POLLIN) != 0

test/mri/tests/io/wait/test_io_wait_uncommon.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22
require 'test/unit'
3+
require 'io/wait'
34

45
# test uncommon device types to check portability problems
56
# We may optimize IO#wait_*able for non-Linux kernels in the future
@@ -12,7 +13,7 @@ def test_tty_wait
1213
end
1314

1415
def test_fifo_wait
15-
omit 'no mkfifo' unless File.respond_to?(:mkfifo) && IO.const_defined?(:NONBLOCK)
16+
skip 'no mkfifo' unless File.respond_to?(:mkfifo) && IO.const_defined?(:NONBLOCK)
1617
require 'tmpdir'
1718
Dir.mktmpdir('rubytest-fifo') do |dir|
1819
fifo = "#{dir}/fifo"

0 commit comments

Comments
 (0)