supplement 2.31.1 → 2.32

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: dff470072491d922eb1edfa3e305fad6323caa366f83379f10065de3c8ce5a84
4
- data.tar.gz: a69fc76a288c99a345e583029fac4678ec591aaa6edd50cf896e77a498147cef
3
+ metadata.gz: 9a7108dafb3707ef51a08d12ac718a6c00358bae7b3f98e32448886f8d9dd29b
4
+ data.tar.gz: d389cf607de0a21d6b4cd3a02550a25200f68205cbaad22ed442025123420bed
5
5
  SHA512:
6
- metadata.gz: cabaaa436d3f1e3a7bfae57e47c2df42980e8011a1f2a745be79489bbbdc164e8ef7a89c420369a0128e743618303649b396f045351009c5e3b85cca1e60e740
7
- data.tar.gz: e5de3d55afe67a240d8efbf35198bed3ca114ef143c1e5a91d221b63ee3c5eea367b76548a250010bcc8eca420cc287f0305f612fb075c746ad267fd3a5ca168
6
+ metadata.gz: e4006b5753eff8a4cce364b2e26a0717493948177e2476818113b7a62070fdf69ff71bc72105a14cf7d02a639471a282e99181e7f702f618678db63483dc7e1e
7
+ data.tar.gz: ae9e62b121909a5cdfb63abea92a3abd2ca71bf887a6364806dd2af55c7e44796bfcaa09cafb326f14f27ffa84332817630c8fb4aced20995220d4b43af0f5b5
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # supplement 2.31.1 -- Useful Ruby enhancements
1
+ # supplement 2.32 -- Useful Ruby enhancements
2
2
 
3
3
  Some simple Ruby extensions.
4
4
 
data/lib/mkrf_conf CHANGED
@@ -10,8 +10,8 @@ Autorake.configure {
10
10
 
11
11
  extending_ruby
12
12
 
13
- if RUBY_VERSION < "3.3" then
14
- enable :old_io_functions
13
+ if RUBY_VERSION < "3.3" then # Always false after March 2026
14
+ enable :some_calls
15
15
  end
16
16
 
17
17
  have_header "ruby/ruby.h"
@@ -28,29 +28,14 @@
28
28
  VALUE
29
29
  rb_locked_init( int argc, VALUE *argv, VALUE self)
30
30
  {
31
- #ifdef FEATURE_OLD_IO_FUNCTIONS
32
- rb_io_t *fptr;
33
- #endif
34
31
  struct timeval time;
35
32
  int op;
36
33
 
37
- #ifdef FEATURE_OLD_IO_FUNCTIONS
38
- GetOpenFile( self, fptr);
39
- #endif
40
-
41
34
  rb_call_super_kw(argc, argv, RB_PASS_CALLED_KEYWORDS);
42
35
 
43
- #ifdef FEATURE_OLD_IO_FUNCTIONS
44
- op = fptr->mode & FMODE_WRITABLE ? LOCK_EX : LOCK_SH;
45
- #else
46
36
  op = rb_io_mode( self) & FMODE_WRITABLE ? LOCK_EX : LOCK_SH;
47
- #endif
48
37
  op |= LOCK_NB;
49
- #ifdef FEATURE_OLD_IO_FUNCTIONS
50
- while (flock( fptr->fd, op) < 0) {
51
- #else
52
38
  while (flock( rb_io_descriptor( self), op) < 0) {
53
- #endif
54
39
  static ID id_lock_failed = 0;
55
40
 
56
41
  switch (errno) {
@@ -72,11 +57,7 @@ rb_locked_init( int argc, VALUE *argv, VALUE self)
72
57
  }
73
58
  break;
74
59
  default:
75
- #ifdef FEATURE_OLD_IO_FUNCTIONS
76
- rb_sys_fail_str( fptr->pathv);
77
- #else
78
60
  rb_sys_fail_str( rb_io_path( self));
79
- #endif
80
61
  break;
81
62
  }
82
63
  }
@@ -13,14 +13,6 @@ static VALUE io_unget( VALUE);
13
13
  static VALUE io_reset( VALUE);
14
14
 
15
15
 
16
- #ifdef FEATURE_OLD_IO_FUNCTIONS
17
- #define RB_FAIL_PATH( io, fptr) ((fptr)->pathv)
18
- #define RB_IO_VAR( io, fptr) fptr
19
- #else
20
- #define RB_FAIL_PATH( io, fptr) rb_io_path( io)
21
- #define RB_IO_VAR( io, fptr) io
22
- #endif
23
-
24
16
  /*
25
17
  * call-seq:
26
18
  * io.unget(str, ...) -> nil
@@ -33,28 +25,20 @@ static VALUE io_reset( VALUE);
33
25
  VALUE
34
26
  rb_io_unget( int argc, VALUE *argv, VALUE io)
35
27
  {
36
- #ifdef FEATURE_OLD_IO_FUNCTIONS
37
- rb_io_t *fptr;
38
- #endif
39
28
  int fd;
40
29
  struct termios oldtio, newtio;
41
30
  void *v[5];
42
31
 
43
- #ifdef FEATURE_OLD_IO_FUNCTIONS
44
- GetOpenFile( io, fptr);
45
- fd = fptr->fd;
46
- #else
47
32
  fd = rb_io_descriptor( io);
48
- #endif
49
33
 
50
34
  if (tcgetattr( fd, &oldtio) < 0)
51
- rb_sys_fail_str( RB_FAIL_PATH( io, fptr));
35
+ rb_sys_fail_str( rb_io_path( io));
52
36
  newtio = oldtio;
53
37
  newtio.c_iflag &= ~ICRNL;
54
38
  if (tcsetattr( fd, TCSANOW, &newtio) < 0)
55
- rb_sys_fail_str( RB_FAIL_PATH( io, fptr));
39
+ rb_sys_fail_str( rb_io_path( io));
56
40
 
57
- v[0] = &fd, v[1] = (void *) RB_IO_VAR( io, fptr), v[2] = &oldtio,
41
+ v[0] = &fd, v[1] = (void *) io, v[2] = &oldtio,
58
42
  v[3] = &argc, v[4] = (void *) argv;
59
43
  return rb_ensure( io_unget, (VALUE) v, io_reset, (VALUE) v);
60
44
  }
@@ -76,7 +60,7 @@ io_unget( VALUE v)
76
60
  p = RSTRING_PTR(str);
77
61
  for (i = RSTRING_LEN(str); i; --i, ++p)
78
62
  if (ioctl( *(int *) vp[0], TIOCSTI, p) < 0)
79
- rb_sys_fail_str( RB_FAIL_PATH( (VALUE) vp[1], (rb_io_t *) vp[1]));
63
+ rb_sys_fail_str( rb_io_path( (VALUE) vp[1]));
80
64
  }
81
65
  return Qnil;
82
66
  }
@@ -87,7 +71,7 @@ io_reset( VALUE v)
87
71
  void **vp = (void **) v;
88
72
 
89
73
  if (tcsetattr( *(int *) vp[0], TCSANOW, (struct termios *) vp[2]) < 0)
90
- rb_sys_fail_str( RB_FAIL_PATH( (VALUE) vp[1], (rb_io_t *) vp[1]));
74
+ rb_sys_fail_str( rb_io_path( (VALUE) vp[1]));
91
75
 
92
76
  return Qnil;
93
77
  }
@@ -105,22 +89,14 @@ io_reset( VALUE v)
105
89
  VALUE
106
90
  rb_io_wingeom( VALUE self)
107
91
  {
108
- #ifdef FEATURE_OLD_IO_FUNCTIONS
109
- rb_io_t *fptr;
110
- #endif
111
92
  int fd;
112
93
  struct winsize w;
113
94
  VALUE r;
114
95
 
115
- #ifdef FEATURE_OLD_IO_FUNCTIONS
116
- GetOpenFile( self, fptr);
117
- fd = fptr->fd;
118
- #else
119
96
  fd = rb_io_descriptor( self);
120
- #endif
121
97
 
122
98
  if (ioctl( fd, TIOCGWINSZ, &w) < 0)
123
- rb_sys_fail_str( RB_FAIL_PATH( self, fptr));
99
+ rb_sys_fail_str( rb_io_path( self));
124
100
  r = rb_ary_new2( 4);
125
101
  rb_ary_store( r, 0, INT2NUM( w.ws_col));
126
102
  rb_ary_store( r, 1, INT2NUM( w.ws_row));
data/lib/supplement.c CHANGED
@@ -110,28 +110,6 @@ rb_krn_tap_bang( VALUE obj)
110
110
  }
111
111
 
112
112
 
113
- /*
114
- * call-seq:
115
- * with { |x| ... } -> obj
116
- *
117
- * Warning. This method will be removed. Use +Kernel#then+ instead.
118
- *
119
- * Yields +x+ to the block.
120
- * The difference to +tap+ is that the block's result will be returned.
121
- *
122
- * Use this to narrow your namespace.
123
- *
124
- */
125
-
126
- VALUE
127
- rb_krn_with( VALUE obj)
128
- {
129
- rb_category_warning(RB_WARN_CATEGORY_DEPRECATED,
130
- "Kernel#with will be removed from the supplement gem. Use Kernel#then instead.");
131
- return rb_yield( obj);
132
- }
133
-
134
-
135
113
  /*
136
114
  * Document-class: Module
137
115
  */
@@ -432,7 +410,6 @@ rb_str_axe( int argc, VALUE *argv, VALUE str)
432
410
  if (newlen < 0)
433
411
  return Qnil;
434
412
 
435
-
436
413
  oldlen = rb_str_strlen( str);
437
414
  if (newlen < oldlen) {
438
415
  VALUE ell;
@@ -1224,7 +1201,6 @@ void Init_supplement( void)
1224
1201
  rb_define_method( rb_cObject, "new_string", rb_obj_new_string, 0);
1225
1202
  rb_define_method( rb_cObject, "nil_if", rb_obj_nil_if, 1);
1226
1203
  rb_define_method( rb_mKernel, "tap!", rb_krn_tap_bang, 0);
1227
- rb_define_method( rb_mKernel, "with", rb_krn_with, 0);
1228
1204
 
1229
1205
  rb_define_method( rb_cModule, "plain_name", rb_module_plain_name, 0);
1230
1206
 
data/lib/supplement.h CHANGED
@@ -12,7 +12,6 @@
12
12
  extern VALUE rb_obj_new_string( VALUE);
13
13
  extern VALUE rb_obj_nil_if( VALUE, VALUE);
14
14
  extern VALUE rb_krn_tap_bang( VALUE);
15
- extern VALUE rb_krn_with( VALUE);
16
15
 
17
16
  extern VALUE rb_module_plain_name( VALUE);
18
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supplement
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.31.1
4
+ version: '2.32'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: 3.1.0
84
+ version: 3.3.0
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="