io-wait 0.3.1 → 0.3.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: ab2e90fe2ac7d5df2d629e3ccd501b8c01570fadd3eeee5d42709e55deb26ec6
4
- data.tar.gz: 12663accc0c74fb25368e47a87fbc7a5b4f06ccd7435ee1ab4528e51b4dca843
3
+ metadata.gz: 8b23249d7a91732a3ca99233b9e8e3a312f9eee5c265bc10d48bb2dddc1f12e2
4
+ data.tar.gz: beb457a9e11965bd25c17b3b52cd45ad2bb422e8316aa251cc2eec3bf371e440
5
5
  SHA512:
6
- metadata.gz: 1bc887d4119a7c39978294b99d6bc2affbc0124236ec4062fe439ffbfa64db295ec4de180a1db16ad2c481927a72f046def66e34dae9cca49157ccd25a8b82e4
7
- data.tar.gz: 1b237ca1a3f74ff1208059f49061df665ff4a78f8da89d9b7ffbb9a57cd9205ffbb848fb583704fafad66954df7f2481d9a145e1d68591c31d11ab8fff1b2dbe
6
+ metadata.gz: 1852c5c78c91a6cf13576311275b0b2b69488018a378511c74027016c6adf4804dcc5d9ef99f0a6012b7aa82b6c0ca9e8a8277132d395785ee62db259ecd09d9
7
+ data.tar.gz: 90ad10e5b5037bb7ee93f6ee317541a59213776669d99c69d49aeef767973f762d908dbdc698a65f6cd88e181e8eed4b8da1c627fa0fc387ef392eb9ae2e0904
data/.document ADDED
@@ -0,0 +1,6 @@
1
+ COPYING
2
+ ChangeLog
3
+ README.md
4
+ _doc/
5
+ ext/
6
+ logs/ChangeLog-*
data/.rdoc_options ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ main_page: README.md
data/_doc/io.rb ADDED
@@ -0,0 +1,3 @@
1
+ # See {IO}[https://docs.ruby-lang.org/en/master/IO.html]
2
+ class IO
3
+ end
data/ext/io/wait/depend CHANGED
@@ -2,7 +2,7 @@
2
2
  wait.o: $(RUBY_EXTCONF_H)
3
3
  wait.o: $(arch_hdrdir)/ruby/config.h
4
4
  wait.o: $(hdrdir)/ruby.h
5
- # wait.o: $(hdrdir)/ruby/assert.h # not in 2.6
5
+ wait.o: $(hdrdir)/ruby/assert.h
6
6
  wait.o: $(hdrdir)/ruby/backward.h
7
7
  wait.o: $(hdrdir)/ruby/defines.h
8
8
  wait.o: $(hdrdir)/ruby/encoding.h
@@ -1,25 +1,21 @@
1
1
  # frozen_string_literal: false
2
2
  require 'mkmf'
3
3
 
4
- if RUBY_VERSION < "2.6"
5
- File.write("Makefile", dummy_makefile($srcdir).join(""))
4
+ target = "io/wait"
5
+ have_func("rb_io_wait", "ruby/io.h")
6
+ have_func("rb_io_descriptor", "ruby/io.h")
7
+ unless macro_defined?("DOSISH", "#include <ruby.h>")
8
+ have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
9
+ fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
10
+ have_macro("FIONREAD", [h, ioctl_h].compact)
11
+ end
12
+ if fionread
13
+ $defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
14
+ create_makefile(target)
15
+ end
6
16
  else
7
- target = "io/wait"
8
- have_func("rb_io_wait")
9
- have_func("rb_io_descriptor")
10
- unless macro_defined?("DOSISH", "#include <ruby.h>")
11
- have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
12
- fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
13
- have_macro("FIONREAD", [h, ioctl_h].compact)
14
- end
15
- if fionread
16
- $defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
17
- create_makefile(target)
18
- end
19
- else
20
- if have_func("rb_w32_ioctlsocket", "ruby.h")
21
- have_func("rb_w32_is_socket", "ruby.h")
22
- create_makefile(target)
23
- end
17
+ if have_func("rb_w32_ioctlsocket", "ruby.h")
18
+ have_func("rb_w32_is_socket", "ruby.h")
19
+ create_makefile(target)
24
20
  end
25
21
  end
data/ext/io/wait/wait.c CHANGED
@@ -84,7 +84,7 @@ io_nread(VALUE io)
84
84
  ioctl_arg n;
85
85
 
86
86
  GetOpenFile(io, fptr);
87
- rb_io_check_readable(fptr);
87
+ rb_io_check_char_readable(fptr);
88
88
  len = rb_io_read_pending(fptr);
89
89
  if (len > 0) return INT2FIX(len);
90
90
 
@@ -143,7 +143,7 @@ io_ready_p(VALUE io)
143
143
  #endif
144
144
 
145
145
  GetOpenFile(io, fptr);
146
- rb_io_check_readable(fptr);
146
+ rb_io_check_char_readable(fptr);
147
147
  if (rb_io_read_pending(fptr)) return Qtrue;
148
148
 
149
149
  #ifndef HAVE_RB_IO_WAIT
@@ -178,7 +178,7 @@ io_wait_readable(int argc, VALUE *argv, VALUE io)
178
178
  #endif
179
179
 
180
180
  GetOpenFile(io, fptr);
181
- rb_io_check_readable(fptr);
181
+ rb_io_check_char_readable(fptr);
182
182
 
183
183
  #ifndef HAVE_RB_IO_WAIT
184
184
  tv = get_timeout(argc, argv, &timerec);
@@ -252,7 +252,7 @@ io_wait_priority(int argc, VALUE *argv, VALUE io)
252
252
  rb_io_t *fptr = NULL;
253
253
 
254
254
  RB_IO_POINTER(io, fptr);
255
- rb_io_check_readable(fptr);
255
+ rb_io_check_char_readable(fptr);
256
256
 
257
257
  if (rb_io_read_pending(fptr)) return Qtrue;
258
258
 
@@ -312,7 +312,7 @@ io_event_from_value(VALUE value)
312
312
  /*
313
313
  * call-seq:
314
314
  * io.wait(events, timeout) -> event mask, false or nil
315
- * io.wait(timeout = nil, mode = :read) -> self, true, or false
315
+ * io.wait(*event_symbols[, timeout]) -> self, true, or false
316
316
  *
317
317
  * Waits until the IO becomes ready for the specified events and returns the
318
318
  * subset of events that become ready, or a falsy value when times out.
@@ -320,10 +320,14 @@ io_event_from_value(VALUE value)
320
320
  * The events can be a bit mask of +IO::READABLE+, +IO::WRITABLE+ or
321
321
  * +IO::PRIORITY+.
322
322
  *
323
- * Returns a truthy value immediately when buffered data is available.
323
+ * Returns an event mask (truthy value) immediately when buffered data is
324
+ * available.
324
325
  *
325
- * Optional parameter +mode+ is one of +:read+, +:write+, or
326
- * +:read_write+.
326
+ * The second form: if one or more event symbols (+:read+, +:write+, or
327
+ * +:read_write+) are passed, the event mask is the bit OR of the bitmask
328
+ * corresponding to those symbols. In this form, +timeout+ is optional, the
329
+ * order of the arguments is arbitrary, and returns +io+ if any of the
330
+ * events is ready.
327
331
  *
328
332
  * You must require 'io/wait' to use this method.
329
333
  */
@@ -360,10 +364,6 @@ io_wait(int argc, VALUE *argv, VALUE io)
360
364
  rb_io_event_t events = 0;
361
365
  int i, return_io = 0;
362
366
 
363
- /* The documented signature for this method is actually incorrect.
364
- * A single timeout is allowed in any position, and multiple symbols can be given.
365
- * Whether this is intentional or not, I don't know, and as such I consider this to
366
- * be a legacy/slow path. */
367
367
  if (argc != 2 || (RB_SYMBOL_P(argv[0]) || RB_SYMBOL_P(argv[1]))) {
368
368
  /* We'd prefer to return the actual mask, but this form would return the io itself: */
369
369
  return_io = 1;
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-wait
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nobu Nakada
8
8
  - Charles Oliver Nutter
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2023-12-13 00:00:00.000000000 Z
11
+ date: 2025-11-04 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Waits until IO is readable or writable without blocking.
15
14
  email:
@@ -20,9 +19,11 @@ extensions:
20
19
  - ext/io/wait/extconf.rb
21
20
  extra_rdoc_files: []
22
21
  files:
22
+ - ".document"
23
+ - ".rdoc_options"
23
24
  - COPYING
24
- - Gemfile
25
25
  - README.md
26
+ - _doc/io.rb
26
27
  - ext/io/wait/depend
27
28
  - ext/io/wait/extconf.rb
28
29
  - ext/io/wait/wait.c
@@ -33,7 +34,6 @@ licenses:
33
34
  metadata:
34
35
  homepage_uri: https://github.com/ruby/io-wait
35
36
  source_code_uri: https://github.com/ruby/io-wait
36
- post_install_message:
37
37
  rdoc_options: []
38
38
  require_paths:
39
39
  - lib
@@ -41,15 +41,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: '0'
44
+ version: '3.0'
45
45
  required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  requirements: []
51
- rubygems_version: 3.5.0.dev
52
- signing_key:
51
+ rubygems_version: 3.6.7
53
52
  specification_version: 4
54
53
  summary: Waits until IO is readable or writable without blocking.
55
54
  test_files: []
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in io-wait.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem "rake"
8
- gem "rake-compiler"
9
- gem "test-unit"
10
- gem "test-unit-ruby-core"
11
- gem 'ruby-maven', :platforms => :jruby
12
- end